Questions tagged [stdin]
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 the [io-redirection] tag for questions on how to redirect input, use [file-descriptors] for questions on how to manage file descriptors, use [lock] for questions of file locking, and use [files] for general questions on file operations.
326 questions
3 votes
1 answer
320 views
Why does dd read only part of the specified data?
In order to test extraction of large files by a batch job, I wanted to create several relatively small archives. As I was creating increasingly large archives, at some point they became partial of the ...
-1 votes
3 answers
271 views
Perl RegEx one-liner that outputs all matches from one line of STDIN
Here is a silly example that effectively illustrates what I need: echo '"this text", " ", "is in speech marks"' | perl -lne 'print "$1" if /"(.*?)"/' ...
5 votes
1 answer
355 views
Making `apt-get` read answers from stdin on graphical Ubuntu
This may seem like a question asked, but I have yet to find anything that works and I start suspecting it may be a bug in apt-get… So, I have a python installer wrapping around apt-get, whose relevant ...
1 vote
0 answers
209 views
Using socat to redirect docker attach's STDIN/STDOUT to a TCP socket
I'd like to use socat to redirect the STDIN/STDOUT of the process executing docker attach <container-id> to a listening TCP socket on my Linux system. root@eve-ng:/opt/unetlab# tty /dev/pts/2 ...
1 vote
1 answer
87 views
How do I ask gnu parallel to preserve stdin?
I'm using GNU parallel like this (:::: is a form of --arg-file): parallel -0Xuj1 my-command -- :::: <(find … -print0) But it seems like the command's standard input is managed by GNU parallel, ...
0 votes
2 answers
135 views
What does '-' as a file parameter mean? [duplicate]
I'm having trouble finding a name for the - character in the context of a piped bash command. What is the - character called? Can I replace it with something more readable for a script? Example ...
1 vote
0 answers
273 views
Redirecting fifo to python's stdin
$ mkfifo mypipe $ echo "hello redirection" > mypipe $ cat < mypipe hello redirection I have problems when I try to do the above with python # pyecho.py with open("/dev/stdin"...
0 votes
1 answer
131 views
Archiving stdout to multiple tapes
I have large files which are generated on the fly to stdout, one every 24hours. I would like to archive these files progressively on tapes, ideally in a single archive which potentially spans multiple ...
0 votes
1 answer
131 views
Script that reads input from terminal. How to tell the script to print to both tty and stdout in case it is called with a stdout redirection?
I have a script which asks users for input in the terminal, therefore in case the script is called with stdout redirected to a file, the user has no context on the prompt. So I would like to duplicate ...
0 votes
1 answer
191 views
How to identify what file descriptors are associated to STDIN, STDOUT etc
I seem to remember some command or envvar that tells you this. I'd like basically something that executed on terminal, for instance, give you echo $STDIN /dev/tty echo $STDOUT /dev/tty fdescribe 0 or ...
0 votes
1 answer
157 views
Standard input stream redirection
stdin: Generally standard input, referred to as stdin, comes from the keyboard. When you type stuff, you're typing it on stdin (a standard input terminal). A standard input device, which is usually ...
0 votes
0 answers
545 views
read single line from stdin and write to a file
Is there a way in bash to read a single line from stdin and write directly to a file? Something like: t="$(mktemp)" while true do [read single line from stdin] > "${t}" [...
0 votes
1 answer
88 views
saving xargs ouput from multi files to one file
I have these three text files : #1.txt hey stackoverflow #2.txt hey stackexchange #3.txt hello world I am using this command to list the last 3 files in my dir and then cat them and then save ...
1 vote
1 answer
149 views
Quote characters work as commands that redirect to the standard input
I am a student and I am trying an excercise that involves assigning a word with quotes, double quotes and other symbols to a file name. The problem is that I am not getting the expected results. I am ...
0 votes
2 answers
2k views
Bash - Check if the standard input contains anything
I know this question has been asked several times but it seems ineffective in my case. [[ ! -t 0 ]] = Does standard input contains anything? This command: echo 'Hello world' | [[ ! -t 0 ]] echo $? ...