Questions tagged [stdin]
The stdin tag has no usage guidance.
50 questions
2
votes
1
answer
33
views
Shell/terminal no longer registers premature input text
Suppose I'm waiting for a long running command to complete.
Before I was able to type the 2nd command, and the entered text would be preserved when the 1st command completed and the prompt returned (...
1
vote
1
answer
37
views
How much data can be reliably passed between processes? [closed]
I have a server written in nodejs which is calling a Rust binary using the spawn functionality and I need to pass a few megabytes worth of data between the binary and the nodejs server. Would it be ...
0
votes
1
answer
108
views
SSH Tunnel via crontab with 2FA gives EOFError
I'm trying to setup a crontab which opens an ssh tunnel. Unlike other questions here and on stackoverflow, the server I'm connecting to has a 2FA which prompts the user for a password. However, I don'...
0
votes
0
answers
80
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.
1
vote
1
answer
171
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 ...
1
vote
1
answer
380
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 ...
2
votes
1
answer
344
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
2
votes
1
answer
3k
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 ...
1
vote
2
answers
4k
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 | ...
1
vote
3
answers
2k
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 ...
6
votes
1
answer
4k
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 ...
1
vote
1
answer
460
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. ...
4
votes
2
answers
12k
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 ...
14
votes
3
answers
4k
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 ...
1
vote
1
answer
545
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.
5
votes
0
answers
1k
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 ...
-1
votes
3
answers
253
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 ...
7
votes
3
answers
15k
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 ...
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 ...
2
votes
4
answers
298
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&...
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 ...
7
votes
3
answers
7k
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 ...
2
votes
1
answer
782
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 ...
-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 ...
20
votes
4
answers
20k
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*
1
vote
1
answer
387
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 ...
4
votes
1
answer
4k
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 /...
4
votes
1
answer
2k
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 ...
1
vote
3
answers
927
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 ...
77
votes
8
answers
144k
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 | ...
18
votes
5
answers
17k
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 /...
2
votes
1
answer
866
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 \*/(.*)/...
0
votes
0
answers
385
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 ...
1
vote
1
answer
3k
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 ...
0
votes
2
answers
2k
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"
;;
...
1
vote
1
answer
133
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 ...
1
vote
0
answers
266
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 ...
2
votes
0
answers
778
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....
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.
5
votes
5
answers
12k
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 ...
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, ...
12
votes
1
answer
3k
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, ...
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
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, ...
0
votes
1
answer
124
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 ...
21
votes
7
answers
30k
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 ...
0
votes
1
answer
59
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 ...
21
votes
3
answers
16k
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 ...
8
votes
1
answer
3k
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'...
15
votes
2
answers
13k
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$ ...