stdin is the name of the default input file descriptor of a process. Since there is really nothing special about `stdin`, you *should not* use this tag. Use [tag:io-redirection] for questions on how to redirect input, use [tag:file-descriptors] for questions on how to manage file descriptors, use ...

learn more… | top users | synonyms

0
votes
0answers
22 views

save outputs and errors to external file from lxterminal

I run compiled python program like this on my linux box (runs automatically after start lxterminal LXDE lxsession autostart): @lxterminal -e sudo /home/user/app.exe > /home/user/app.out ...
0
votes
1answer
39 views

openssl dgst -sha1 -hmac “key” producing an extraneous “(stdin)= ” prefix and trailing newline

if you run: while read CTFid; do echo -n "$CTFid" | openssl dgst -sha1 -hmac "key"; done < CTFid.csv > OPKlist.csv i am getting (stdin) in the prefix like so ...
3
votes
2answers
59 views

What are the default stdin and stdout of a child process?

I would like to know what are the default stdin and stdout of a child process (if there are such defaults). Are stdin and stdout of a child process the same as its parent process? Is this something ...
0
votes
1answer
35 views

Cygwin - tail stops reading input pipe after first write

I have the following script to run my application in Ubuntu with redirecting its input (where $in is named pipe which is used to send text lines to stdin). tail -f "$in" | "$app_bin" $app_args & ...
0
votes
2answers
51 views

Will the stdout output of a background process be taken as the stdin input of the foreground process?

When a background process outputs to stdout to appear on terminal, will the output be taken as stdin input to the foreground process? Note that the background and foreground process are not related by ...
1
vote
2answers
89 views

How to redirect STDIN of background process?

In my Ubuntu, i run java application in background. I use bash script to run it and now it looks like: nohup java -jar app.jar & exit 0 The problem that i want to be able to write an input ...
1
vote
1answer
54 views

How to pipe html into lynx?

I am testing some ajax call from the console. I like get rid of the meta-information noise that is html markup and just read the content, hence I like to pipe it into a terminal browser, e.g. lynx. ...
1
vote
2answers
183 views

Read from and write to file from stdin and stdout

I need to continually read from and write to a (virtual) file in bash, without closing the file in between. I'm looking for a program which will open the file for read and write, read from stdin and ...
3
votes
2answers
45 views

vim: Force specific syntax via command-line argument

When I want to easily read my PostgreSQL schema, I dump it to stderr and redirect it to vim: pg_dump -h localhost -U postgres dog_food --schema-only | vim - This gives: vim does not have a ...
0
votes
4answers
41 views

Difference between open file & open STDIN, when to use each [duplicate]

In very lot of answers, mainly about text-processing commands, I saw commands such as sed, awk, grep, among other, being used with STDIN and the simple open of a file e.g. $ sed -e 's|foo|bar|g' ...
1
vote
1answer
60 views

Scripting SSH function getting `Connection refused` error

I am using fish as shell, ssh shortcut function as following: function sshec2 ssh -i $HOME/.ssh/key.pem -t -t "ubuntu@$argv[1]" end To ssh into specific AWS EC2 instance, I wrote command pipe ...
-1
votes
1answer
67 views

How does a program detect the end of stdin input?

How does a program detect the end of stdin input? There are several ways of providing stdin input to a program. When using here-document, we specify a delimiter to signal the end of stdin input: ...
1
vote
1answer
94 views

patch: “bad file descriptor” in combination with pipe and LD_PRELOAD/ libtrash

Very short summary: cat "$file" | patch produces a Bad file descriptor-error, but patch < "$file" works, when libtrash is preloaded with LD_PRELOAD, and only on bigger projects. Description: For ...
0
votes
2answers
133 views

Why does the cd command handle STDIN different than other commands?

Commands like cd cannot have output piped to them in order to change directories--they require command-line arguments. Why does the cd command (and those similar to it, such as mv, cp, & rm) not ...
3
votes
3answers
57 views

How to pipe data from one command to another command which allows only a file as an argument?

I have some arbitrary data as an output of a command (e.g. a fragment of a binary data put out using tail). I want to feed it to another command/program which allows only a file as an argument (e.g. ...
2
votes
1answer
59 views

How do I turn entire stdin into a command line argument verbatim?

Attempt 1 xargs -I '{}' -0 -n 1 myprogram --arg '{}' --other-options But that does not preserve zero bytes. Also the program may run multiple times. But instead of failing in case of zero byte ...
1
vote
1answer
44 views

Why doesn't cc (the C compiler) and similar utilities use standard streams by default? [closed]

Background If think most of us agree that filters and pipes are the very foundation of Unix systems. Pipes and filters are very powerful tools. Almost all Unix utilities use the standard input and ...
2
votes
1answer
134 views

vimdiff to compare output instead of files

I am trying to compare two command output (no files) vimdiff "$(tail /tmp/cachain.pem)" "$(tail /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem)" I tried playing with redirection, pipe, and vim - ...
0
votes
2answers
207 views

While loop for bash scripting to read either stdin or arguments

I'm playing around with the accepted answer from this thread: Bash script that reads filenames from a pipe or from command line args? When I use the below script, efetch ...
2
votes
1answer
64 views

How to trick an application expecting a file:// to read from stdin?

A file URI scheme makes it possible to specify an URI to a file stored locally, such as file:///home/demo/sample. Could it be used to specify stdin? For instance, with CURL: curl ...
1
vote
1answer
52 views

Trying to redirect <enter> and second response to linux shell script

I'm trying to automate a process that creates a binary response file using a java program wrapped by a sh script (so many things wrong with this, but not my code). The result I want requires hitting ...
1
vote
2answers
125 views

Duplicate stdin to stdout and stderr, but in a synchronized way

I need to duplicate the stdout of a producer and feed it to two consumer in a synchronized fashion. consumer 1 producer | duplicator | consumer 2 ...
6
votes
2answers
112 views

Notification Listener Behaving Strangely when Backgrounded

I've been struggling to get my IRC-Bouncer/Notification Script working. This is meant to be a script which will automatically login to a remote machine, attach to a screen session (or start one if ...
0
votes
2answers
77 views

Interactively remove files in loop with standard input redirection

I need to interactively (i.e. rm -i) remove files stored in variable $to_remove (one path per line). Unfortunately my code doesn't work because standard input is already used by redirection ...
6
votes
3answers
187 views

Peek at the contents of stdin

I'm trying to debug a Linux application that can receive commands via stdin, and it would be really useful to be able to see everything that gets written to stdin. My first approach was to execute ...
3
votes
3answers
105 views

Wait for key in shell script that may get piped to /bin/bash

Consider the following shell script echo foo; read; echo bar Running bash my_script outputs 'foo', waits for the return key and outputs 'bar'. While this works fine running it that way, it doesn't ...
1
vote
3answers
123 views

How to write a script that can take input from stdout

I want to be able to write a script that can take stdout as an argument, if anything is piped into it (ultimately, I would like it to be polymorphic) - The trouble is, I have searched and searched ...
3
votes
2answers
477 views

How do I filter stdout of a program through grep while still controlling the program?

I'm trying to filter the output of the mpv media player, removing a particular line, but when I do so I am unable to control mpv with the keyboard. Here is the command: mpv FILE | grep -v 'Error ...
3
votes
4answers
247 views

Provide strings stored in a file as a list of arguments to a command?

I install a list of URLs in a text file named myurls: http://www.examples.com/1 http://www.examples.com/2 http://www.examples.com/3 How shall I pass these URLs to wkhtmltopdf as inputs? The direct ...
18
votes
3answers
2k views

How to “less” a file named “-”?

I accidentally created a file with the name - (eg, seq 10 > -). Then I tried to use less to view it, but it just hangs. I understand that this is happening because less - expects input from stdin, ...
1
vote
1answer
173 views

TTY control characters sent to stdin of sh doesn't work

I tried to develop a remote app that launches sh and resends an incoming data there, and found that some special sequences don't work. So, for testing purposes, I launched on my desktop sh, then ...
4
votes
4answers
771 views

How can I get the size of stdin?

I'm about to compress a large directory and I want to know how large, exactly, the resulting file will be. I've tried using du: $ tar -cv dir | du -h - du: cannot access '-': No such file or ...
1
vote
2answers
923 views

How to pass password to mysql command line

I have MySQL password saved on a file foo.php, for example P455w0rd, when I try to use it: $ cat foo.php | grep '$dbpwd=' | cut -d '"' -f 2 | mysql -U root -p mydb -h friendserver Enter password: ...
6
votes
1answer
587 views

Terminal does not accept pasted or typed lines of more than 1024 characters [duplicate]

When I enter text on stdin in an OS X Terminal, a single line is limited to 1024 characters. For example, cat > /dev/null beeps after I type (or paste) a line longer than this, and refuses to ...
3
votes
2answers
214 views

Remove data from the STDIN stream buffer of another TTY session

I encountered a problem the other day while running multiple tty sessions in separate terminal windows. I was running a expensive disk access command and was waiting for it to return. Meanwhile I was ...
0
votes
1answer
325 views

OpenVPN via systemd fails with stdin error

OpenVPN starts and runs just fine when I invoke it directly from the command line, but when I try to start it as a process via systemd, it throws a failure error that I can't find a solution to. ...
-1
votes
1answer
37 views

Does those two constructions do the same thing: proces <input.txt vs cat input.txt | process in Linux

Does those two constructions do the same thing: proces <input.txt vs cat input.txt | process in Linux?
4
votes
2answers
319 views

uniq and bash for loop not writing to stdout before stdin closing (for one-line website visitor notification system)

I'm trying to trigger a beep on the PC speaker for every unique visitor of a website. After some brainstorming, it seemed to be possible with one line: for e in `ssh me@mymachine "tail -n 1 -f ...
1
vote
1answer
49 views

Bourne shell: ignoring certain kinds of stdin

I have a program that is currently working, but I need to modify it to ignore some stdin that is not fitting for its correct function. Right now, to run the program: printf "1\n3\n5\n" | sh prog The ...
0
votes
0answers
44 views

stdin read notification

I want to detect when/if an application issues read(stdin, ...). Is it possible to use unbuffered I/O so that I could wait on write in external process? The problem: Some commands require user input ...
3
votes
1answer
58 views

Question about interactive detection in bash

I have a question about interactive detection in bash. The following script prints if it is called in interactive mode or not. $ cat int.sh #!/bin/bash if [ -t 0 ]; then echo "interactive" ...
1
vote
2answers
93 views

Using find and aspell together

I'm trying to spell check all the *.md files in my current directory but the following command fails: >> find . -maxdepth 1 -name "*.md" | xargs -I {} aspell check {} xargs: aspell: exited with ...
19
votes
3answers
1k views

Is it safe to type another command into STDIN while the previous command is writing to STDOUT?

Perhaps this has been answered previously, I would welcome a link to another answer... If I execute a shell command (in a bash shell) like the following: make Then while the output from make is ...
1
vote
2answers
312 views

Stdin Input Behavior Between “cat” and “less”

When I issue cat, the terminal hangs waiting for stdin input. However, when less is issued, I get Missing filename ("less --help" for help). It is known that both less and cat accepts stdin input. ...
5
votes
3answers
268 views

Echoing stdin when running an ed(1) script

Given the following ed script, $ cat helloworld a hello world . ,n ,s,o,O,g ,n Q I would like to obtain somehow the interactive output $ ed a hello world . ,n 1 hello 2 world ,s,o,O,g ,n 1 ...
0
votes
1answer
1k views

Command that prints file contents given filename on stdin

I have a command that produces some output part of which is actually a file name containing the full output data. I want to extract the file name (which I trivially do with cut) and then pass it to ...
3
votes
1answer
546 views

Run vsim from dmenu — it only works when directly invoked in the terminal

Works: vsim, sh -c vsim Doesn't work: echo "vsim" | sh, echo "vsim" | xargs -I {} sh -c "{}" I want to run ModelSim (vsim) with dmenu, which is triggered using xbindkeys. Details vsim is a ...
1
vote
2answers
3k views

Redirect stdin and stdout to ports

I'd like to take a program P that reads from stdin & writes to stdout, but connect it to nc or whatever such that it reads from a certain port and outputs to another port. # The reading is easy, ...
1
vote
2answers
1k views

cat STDIN won't work twice in script

I have a script that outputs various information and the text fields of an html form (method POST). When I attempt to cat <&0, it displays properly. However a few lines down, I try to cat ...
0
votes
1answer
219 views

Can pocketsphinx_continuous read from stdin?

There is one parameter -adcdev "Name of audio device to use for input.", but it doesn't say if this can be stdin. Can pocketsphinx_continuous read from stdin?