Questions tagged [stdin]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

MacOSX cuts off stdin at 1023 chars

How can I change the limit? I don't know how to change the tty in mac terminal. Are there any way to do it? I also cannot use pbpaste in my python input.
user avatar
  • 101
1 vote
1 answer
63 views

How can I send CR (i.e. ascii 13) to a c program from keyboard (running linux)? ALSO, why do I have to send EOF twice to terminate this program?

I have read that Ctrl-J sends '\n', Ctrl-M sends '\r' and Ctrl-D sends EOF, but either this is incorrect or I'm simply not understanding what's happening. This simple program illustrates: const ...
user avatar
  • 13
1 vote
1 answer
110 views

Display inputs that are redirected from file

I have a Linux program that gives the user a prompt, takes a one line input from stdin, performs an action, and then returns to the prompt to repeat (unless the action is "exit"). I would like to ...
user avatar
1 vote
1 answer
168 views

How to pipe stdout into stdin of optipng?

Is there any way to do something like this: (or why below code doesn't work?) type input.png | optipng -out output.png p.s: type is Windows version of cat Unix command
user avatar
1 vote
1 answer
558 views

Why doesn't piping work for a command that expects stdin?

So, I was looking to take the output of unzip -Z1 into an array and found this answer; their first option, using mapfile and process substitution WITH input redirection, works a charm. But then I ...
user avatar
  • 2,327
0 votes
2 answers
2k views

"Unable to retrieve file contents" trying to supply ansible playbook from stdin

I wanted to supply a playbook to ansible-playbook 2.4.2.0 from stdin on RHEL 7.5, I found this post which seemed very promising but it's not working for me: $ cat ~/simple-ansible-playbook.yaml | ...
user avatar
  • 1
0 votes
3 answers
494 views

How to reference stdin as an option in a program in a pipeline?

I have a program that outputs a file that I want to use as stdin for the next program. However, program2 has "-in" and "-out" options that want filenames. So if I'm piping into program2, how can I ...
user avatar
3 votes
1 answer
2k views

Cat hangs when attempting to read empty STDIN

My script attempts to gather information that may or may not be present in STDIN at execution time, but cat hangs if the pipe is empty. How can I ensure that my script skips this step if this there is ...
user avatar
1 vote
1 answer
341 views

Multiple stdout to one stdin

I'm on Windows, although I could be on Linux so solutions for either are welcome. I have a program that is essentially a game with 4 players that take an instruction from each of those players. ...
user avatar
  • 123
4 votes
2 answers
10k views

Piping commands into nc

I've seemingly searched many very similar questions but never quite found something to work. I'm trying to use a raspberry pi (2nd gen) to communicate with a Wifi OBDII sensor. I'm able to use the ...
user avatar
  • 41
13 votes
3 answers
3k views

Two Programs having their StdIn and StdOut tied

Suppose I have two programs called ProgramA and ProgramB. I want to run them both simultaneously in the Windows cmd interpreter. But I want the StdOut of ProgramA hooked to the StdIn of ProgramB and ...
user avatar
0 votes
1 answer
347 views

Redirect keyboard input to unfocused program

While one program is focused (a full screen web browser) I want to pass keyboard input to another unfocused program (an ssh terminal) in Raspbian/Pi3.
user avatar
2 votes
0 answers
555 views

See contents of conhost

Every now and then, various programs create conhost.exe processes on my (Windows 7 x64) computer. I know they are console windows, except the windows themselves are hidden. I don't suspect any ...
user avatar
-1 votes
3 answers
145 views

How to use the command "read" on a Shell script which reads its arguments from stdin

First of all, thank you for your help in advance and sorry in case this was answered before. I have not been able to find it. For helping to understand my question, I have written the following ...
user avatar
  • 1
7 votes
3 answers
10k views

Feeding multiline input (here documents) to commands in cmd.exe scripts

In Bash, I can do something like this somecmd << END a lot of text here END to feed input to a command directly from a script. I need to do the same in CMD.exe batch files (.cmd scripts). Is ...
user avatar
  • 667
1 vote
1 answer
1k views

Use sendmail without standard input

I would like to use sendmail to send an e-mail from my backup software on Kubuntu Linux. However the software does not allow entering a full command line (only command name and arguments pattern ...
user avatar
2 votes
4 answers
285 views

python2.7 from macports stdin issue

My python2.7 from macports seems to mess up with osx terminal in a weird way. Here is what I mean. The exact input from the keyboard was: /opt/local/bin/python2.7<ENTER> a = 3<ENTER> a&...
user avatar
  • 135
0 votes
1 answer
1k views

Pipe string to a command with multiple read prompts

How can I pipe a string to a command with multiple read prompts in OS X? I am running a command for a Parallels VM to enable a password which prompts for multiple values (without running a secondary ...
user avatar
5 votes
3 answers
5k views

zip extractor reading archives from stdin

As follows from UNZIP(1L) man page Archives read from standard input are not yet supported Are there another CLI programs running under Linux/cygwin which can extract from zip archives reading ...
user avatar
  • 225
2 votes
1 answer
603 views

Ghostscript -- Stay In Interactive Mode

When I pipe postscript data into the gs program, gs interprets the data and then immediately exits. This matches the man page: - This is not really a switch, but indicates to Ghostscript ...
user avatar
  • 1,191
-1 votes
1 answer
1k views

How to pass STDIN to wall in OS X?

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/wall.1.html The OS X man page seems to be almost identical to the Linux one, at least at the beginning, wherein it ...
user avatar
17 votes
4 answers
15k views

Who deals with the star * in echo *

Who deals (interprets) the * in echo * Does the echo see the star or the shell take care about it and return a list of filename .. What about cp temp temp*
user avatar
  • 383
1 vote
1 answer
237 views

Head waits for full stdin before printing

When one runs ls | head head seems to wait for the full output of the piped command before printing to screen. This is undesirable when the command will take a very long time to run, such as when ...
user avatar
4 votes
1 answer
3k views

shell standard streams redirection order OR 2>&1 1>/dev/null vs 1>/dev/null 2>&1

Can somebody please clarify differences? Is some of those considered as best practice? If I remember correct I somehow on SO read that this 1>/dev/null should precede this: 2>&1 ls -al /...
user avatar
4 votes
1 answer
1k views

Run command for every line of a file in bash, passing lines as standard input

How do I pass some input to a command line by line (ie. invoke the command for every line)? xargs does not work because it passes the lines as arguments, not as standard input. The specific case ...
user avatar
  • 2,813
1 vote
3 answers
821 views

Can the contents of /dev/disk0 (/dev/sda, etc) be used as stdin?

I'm learning about the /dev filesystem. I've begun with /dev/sd* (Linux) and /dev/disk* (OS X), and I've found some interesting behaviour. If I run: $ sudo xxd -l 1024 /dev/disk0 I get the following ...
user avatar
  • 1,351
70 votes
8 answers
131k views

How to write a script that accepts input from a file or from stdin?

How can one write a script that accept input from either a filename argument or from stdin? for instance, you could use less this way. one can execute less filename and equivalently cat filename | ...
user avatar
12 votes
4 answers
11k views

compare two directory trees

I have two music libraries, one a newer version than the other. I would like to compare them to figure which files I need to copy from new music tree to old. I have tried diff --brief -r /...
user avatar
  • 315
2 votes
1 answer
601 views

Using the same file as stdin and stdout results in empty file

If want to filter a file but if I use the same file as input and output the output file is empty. Is there another solution instead of using a second file? php -r "echo preg_replace('~/\* DEV \*/(.*)/...
user avatar
  • 23
0 votes
0 answers
304 views

How can I get RAR to create a segmented archive (volumes) when compressing from stdin?

I have this ZFS box where I'm creating incremental snapshots, then piping them into RAR (4.2) for compression and encryption, and finally backing those files up remotely. Thing is, RAR seems to ...
user avatar
1 vote
1 answer
2k views

Type an EOF without a line break

I have a little command that I use to copy/paste files around that involves pasting the base64-encoded tar archive into stdin, but the base64 utility keeps giving me and error message about my input ...
user avatar
  • 1,039
0 votes
2 answers
1k views

Using a file input as stdin for a shell script does not work

I have the following script code: test.sh echo "BEGIN" while read CMD <&1; do [ -z "$CMD" ] && continue case "$CMD" in start) echo "get_start" ;; ...
user avatar
1 vote
1 answer
72 views

How is standard input displayed on a terminal?

According to the Wikipedia article on standard streams, The keyboard is connected to a program via standard input. I'm assuming the program refers to a shell, which interprets the commands inputted by ...
user avatar
  • 19
1 vote
0 answers
218 views

how to simulate a file under linux?

I'm basically trying to do this using openssh: I have a private key, however it isn't in file (it's in memory). Now, I want to create the public key in openssh format. For that I would generally run ...
user avatar
2 votes
0 answers
650 views

Why the here-strings in bash are slower than piping the input to a command?

I compared the execution time for unix here-strings and pipe data input to bc: pipe time for i in {1..1000} do echo "sqrt(5.09)" | bc -q > /dev/null done real 0m3.584s user 0m0....
user avatar
  • 1,267
2 votes
1 answer
4k views

"stdin: is not a tty" message from scp

I got this message when I copy file using scp to CentOS server "stdin: is not a tty". What it means and how I make it go away? The transfer is ok.
user avatar
  • 2,593
3 votes
5 answers
10k views

Bash/csh: test for end of file (EOF) of stdin

I would like to do: if not eof(stdin): pass stdin to program else: do nothing I have a feeling that it can be written fairly close to: if test ! --is-eof - ; then exec program The problem ...
user avatar
  • 4,204
4 votes
3 answers
4k views

Supply SU password in a bash script, within the script?

The purpose is to restart the machine if it doesn't get an abort command from the user. The problem is that the way the terminals are set up, user must supply SU password for shutdown, init, reboot, ...
user avatar
  • 483
10 votes
1 answer
2k views

Read from stdin to new, named, file in vim

I'd like to start vim on a non existing file, named f, with the content c. Both f and c are arbitrary and I'd like to not have to put anything in the vim config to fill new buffers with c. Basically, ...
user avatar
  • 311
0 votes
1 answer
2k views

Is it possible in ffmpeg to seek to position of the file that is received through stdin

Is it possible to -ss in ffmpeg to the file, that is being received via pipe? So that I start reading it from a given timecode? I am not encoding the file. Thanks
user avatar
  • 195
2 votes
1 answer
2k views

When I run a program over ssh, why does stdin stop echoing back?

When I run a particular program on my server using putty and I hit ctrl+c to stop it, my stdin stops echoing back to me at the command line. So for example, after running the program and stopping it, ...
user avatar
  • 335
0 votes
1 answer
55 views

Piping results back into the program that generates them

I've got a program that can take input from stdin and produces output in the stdout like this: cat initial_input.txt | myprogram myindex myoptions - | filter_output > outfile.txt The program ...
user avatar
  • 3,779
19 votes
6 answers
25k views

Clear stdin before reading

I have the following bash script: # do some time consuming task here read -p "Give me some input: " input Now as you might have guessed, if a user presses some random keys during the "time consuming ...
user avatar
  • 295
0 votes
1 answer
56 views

Launching a program and retrieving its standard streams later

I want to be able to start some specific servers (related to a game) on a my VPS (to which I connect through ssh). This is simple, I just connect and execute the command, but this creates some ...
user avatar
  • 455
17 votes
3 answers
13k views

Windows how to redirect file parameter to stdout? (Windows equivalent of `/dev/stdout`)

Windows console: Tool A can write binary data to a file, but has no option for telling it to use stdout. Tool B can read binary data from stdin and process the info in it. How can I get the output ...
user avatar
8 votes
1 answer
2k views

Getting back to "stdin" after redirecting a file to a particular program

I need to achieve a particular effect using bash's redirection facilities. I know that I can redirect a file to some program's standard input: [user@host]$ application < file.txt The thing is, I'...
user avatar
  • 1,927
14 votes
2 answers
11k views

Indicating end of Standard Input

How does one indicate that one has finished entering test in stdin? For example, let's say that I wish to encrypt 'blue' using MD5 (I know MD5 is unsecure, but just for this example). I tried user$ ...
user avatar
  • 2,443