Questions tagged [stdout]
stdout is the name of the default output file descriptor of a process. Since there is nothing special about `stdout`, you *should not* use this tag. Use the [io-redirection] tag for questions on how to redirect output, 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.
486 questions
15
votes
2
answers
2k
views
Why does "seq 1000000 | tee /dev/stdout" produce more single-digit numbers than expected?
I'm in Linux and in Bash. I expect
seq 1000000 | tee /dev/stdout
to always output 9 numbers from 1 to 9 and their duplicates (18 in total). But when I do
seq 1000000 | tee /dev/stdout | grep -c '^[1-...
1
vote
0
answers
31
views
reading stdout from /proc [duplicate]
I'm running the following C program
// hello.c
#include <stdio.h>
#include <unistd.h>
int main() {
while (1) {
printf("Hello\n");
fflush(stdout);
sleep(1);
}
...
7
votes
2
answers
1k
views
How to find out if a command wrote to stdout or not
I'd like to figure out if an external program ran successfully and wrote something to stdout, or if it did not write anything, which happens in case an error occurred. The program unfortunately always ...
5
votes
2
answers
331
views
Duplicate stdout to pipe into another command with named pipe in POSIX shell script function
mkfifo foo
printf %s\\n bar | tee foo &
tr -s '[:lower:]' '[:upper:]' <foo
wait
rm foo
This is a working POSIX shell script of what I want to do:
printf %s\\n bar is symbolic for an external ...
-1
votes
1
answer
126
views
Why is the printf Output Order Not Respected in a Concurrent Scenario with Piped or Redirected stdout?
We are in a concurrent scenario where we have n concurrent processes. By using a synchronization policy (e.g., using pipes or signals), each process can print using printf("string\n") only ...
0
votes
1
answer
1k
views
Set StandardOutput=null in the service file which starts a script is equivalent to the redirection of the standard output of the script to /dev/null?
My current service and shell script
I have a systemd service file called myservice.service. The service is started at boot. The service starts the shell script /usr/bin/myscript.sh as you can see ...
0
votes
2
answers
518
views
Redirecting stdout with > and stderr with >> to same file leaves out stderr
I'm redirecting stdout and stderr to the same file by using > and >> respectively:
rsync -a --exclude cache/ src_folder/ target_folder/ 1>out_err.log 2>>out_err.log
However the ...
2
votes
1
answer
137
views
In zsh, annotate each line in a file to which both stdout and stderr have been redirected with the line's source (stdout or stderr)
In zsh, how can I annotate each line in a file to which both stdout and stderr have been redirected with the line's source (stdout or stderr)?
I want output with the source name prepended to the line, ...
0
votes
1
answer
206
views
How to put all function/command call output results to different corresponding vars: for stderr, for stdout, for string result and for return code?
I want to extend question How to store standard error in a variable and get general solution (bash function or functions) to extract from the called function/command together with standard error also ...
0
votes
1
answer
213
views
Use grep to search stdout, without replacing stdout
At the moment, I have this in a wrapper script:
2>&1 ./update.sh | ts | tee -a ./update.log
and this in update.sh:
if apt full-upgrade -y | grep linux-headers
then
echo
echo Need to ...
2
votes
1
answer
163
views
How to "render" ouput from a command playing with tput so only the final terminal-postprocessed result is kept? [duplicate]
I captured the output of a script that uses tput to draw certain things on screen. When I perform cat myoutput then everything is well seen (looks like terminal reinterprets it from beginning), but ...
0
votes
1
answer
127
views
How to bring disowned command back into current terminal (stdout)
I executed a command which I then disowned so that it can continue to run in the background, even if I closed the terminal.
The command is:
badblocks -v -s -w /dev/sdb > badblocks_result.txt 2>&...
0
votes
1
answer
171
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
2
answers
141
views
Where output of Bash itself goes?
For one script I wanted to redirect "[1] 00000" message that appears my shell after sleep 100& command. I don't need that anymore, but while struggling with that problem, I start ...
0
votes
1
answer
184
views
Capture output from SOX "-n stat"
I am trying to capture/pipe the output from the following:
arecord -f S16_LE -qd 5 file && sox file -n stat
output:
Samples read: 8000
Length (seconds): 1.000000
Scaled by: ...