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
2answers
54 views

where is the location of stdin, stdout, stderr file descriptor in AIX(unix)

In my Linux environment, the file descriptors are located on /dev/fd. Where is the location of stdin, stdout, stderr file descriptor in AIX(unix). I couldn't find them.
8
votes
2answers
26k views

nohup: ignoring input and redirecting stderr to stdout

I am starting my application in the background using nohup as mentioned below - root@phx5qa01c:/bezook# nohup java -jar ./exhibitor-1.5.1/lib/exhibitor-1.5.1-jar-with-dependencies.jar -c file --...
1
vote
3answers
70 views

gzip same input different output

Check out: data/tmp$ gzip -l tmp.csv.gz compressed uncompressed ratio uncompressed_name 2846 12915 78.2% tmp.csv data/tmp$ cat tmp.csv.gz | gzip -l ...
0
votes
1answer
40 views

What's the proper way to read stdin inside parenthesis assignment of 2nd pipe

1st style, group 2 pipe to assign, this works: $ myresult1=$(curl -L 'https://archive.org/wayback/available?url=stackoverflow.com' 2>/dev/null | jq '.archived_snapshots.closest.url'); echo "$...
6
votes
2answers
117 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 ...
3
votes
0answers
18 views

Archive Manager doesn't show file with the name “-”

Given that I made a .zip file by piping from stdin like this: $ echo foo | zip temp.zip - This produces an archive OK (with the data in a file named "-"): $ unzip -t temp.zip Archive: temp.zip ...
0
votes
0answers
31 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 2>&...
0
votes
1answer
64 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 (stdin)=...
3
votes
2answers
124 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 ...
5
votes
4answers
3k views

Getting stdin from a named pipe

What I am trying to do is run python in a terminal window and redirect it's stdin from a named pipe. Then I write to the named pipe in another terminal and have that command execute on python. ...
0
votes
1answer
39 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
80 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
166 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
78 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. ...
43
votes
9answers
12k views

How to do nothing forever in an elegant way?

I have a program which produces useful information on stdout but also reads from stdin. I want to redirect its standard output to a file without providing anything on standard input. So far, so good: ...
1
vote
2answers
250 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 ...
6
votes
6answers
1k views

Is it possible to feed Open Office via STDIN?

I have an Open Office Spreadsheet document stored inside a bash variable. I want to do something like the following to feed Open Office via STDIN: echo "$openOfficeDoc" | ooffice But it doesn't ...
3
votes
2answers
65 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
47 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
71 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
77 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: &...
8
votes
3answers
2k views

Construct a command by putting a string into a tty

I managed to do this echo -n "command" > /dev/tty1 The letters appear, and the cursor moves, but they are "ghosts" – if you hit Enter, nothing happens (they are not in stdin). Edit: In the ...
1
vote
1answer
139 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
145 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
64 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
63 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 ...
6
votes
5answers
4k views

Bash script that reads filenames from a pipe or from command line args?

I want my script to read a bunch of filenames (which may have spaces) given either as a glob or from STDIN and do stuff with them. I've been able to read either way separately, but not combine them. ...
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
1answer
46 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
79 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 file:///home/demo/...
3
votes
1answer
213 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
259 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 (ftp://ftp.ncbi.nlm.nih.gov/...
1
vote
1answer
465 views

Identify when python script is waiting for a manual input

I'm writing a shell script which executes a Python script. The Python script halts for a manual enter to be provided. However, I don't want to have to press enter each time to the script. Instead, I ...
1
vote
1answer
68 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 [...
4
votes
3answers
937 views

Bash, name of the stdin file?

I have to write a bash script which will count symbols like "<" and ">" from stdin. For example: $ ./myscript.sh <example.html > - 20 < - 21 Found mismatching brackets! I did this: x=`...
1
vote
2answers
142 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
3answers
264 views

Are unix[-like] programs capable of determing where their output is going? [duplicate]

Up until recently I was under the impression that Unix-y programs were unaware of where their output went, be it to standard out, redirected to a file, or into a pipe. However, an unrelated U&L ...
0
votes
2answers
91 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 <<&...
4
votes
2answers
349 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 /var/...
6
votes
3answers
240 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
113 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
136 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
658 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 ...
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, ...
3
votes
4answers
291 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 ...
1
vote
1answer
192 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
823 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 ...
6
votes
1answer
735 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 ...
1
vote
2answers
1k 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: (...
16
votes
3answers
3k views

Why do some commands not read from their standard input?

I wonder what when we should use pipeline and when we shouldn't. Say for instance, to kill certain process which handling pdf files, the following will not work by using pipeline: ps aux | grep pdf |...