All Questions

Tagged with
Filter by
Sorted by
Tagged with
1
vote
1answer
96 views

Understanding File Streams and File Descriptors

For extra context, I asked this question earlier, and thought I understood things, but not anymore. I know that echo ignores stdin. I know that stdin, stderr and stdout exist and, in this context, I ...
5
votes
1answer
957 views

Opening named pipe blocks forever, if pipe is deleted without being connected

Try the following shell commands: mkfifo /tmp/test.pipe ls -1 /tmp > /tmp/test.pipe & rm /tmp/test.pipe mkfifo /tmp/test.pipe cat /tmp/test.pipe & jobs The ls command is just an ...
6
votes
1answer
653 views

Why can't I do ls -a 1>&-?

Why can't we just close stdout for a process? I was trying out redirection commands. The following works: ls -a 0>&- ls -a 2>&- which means close stdin and stderr for the process ls -...
2
votes
1answer
126 views

Unexpected behavior of file descriptor and/or I/O streams after running sqlcmd with -i option (read sql from file) in ksh creates infinite loop

Is there a way to use sqlcmd with -i input_file option without creating an infinite loop in my ksh script? The code reads lines from $file and parses it line-by-line to extract data and process other ...
54
votes
5answers
12k views

How portable are /dev/stdin, /dev/stdout and /dev/stderr?

Occasionally I need to specify a "path-equivalent" of one of the standard IO streams (stdin, stdout, stderr). Since 99% of the time I work with Linux, I just prepend /dev/ to get /dev/stdin, etc., ...