All Questions
31 questions
3
votes
3
answers
183
views
How to quit from a pipeline "command1 | command2" while keeping a background subprocess launched by command1 alive?
Regarding the command cmd1.sh | grep "message", in which cmd1.sh is as below
#!/bin/bash
echo "message from foreground father proess$(date)"
setsid sleep 100 &
echo "...
6
votes
1
answer
749
views
bash pipe loses data when command crashed
Consider this simple program (abort.py) that writes some text to stdout and stderr and then crashed (abort()).
import os
import sys
print("end stdout")
print("end stderr", file=...
4
votes
1
answer
461
views
pipe to a different file descriptor
Following up on Using while loop to ssh to multiple servers, i.e., for
while IFS= read -r -u9 HOST ; do ssh "$HOST" "uname -a" ; done 9< servers.txt
which reads from a ...
0
votes
1
answer
41
views
Intercepting/debugging wrapper over a program with bidirectional command/response interface
I have a command-line program, the target, that implements a command/response interface over stdio (for other programs, not for humans).
Specifically:
the consumer of this program starts it up
reads ...
13
votes
2
answers
36k
views
How to grep multiple strings when using with another command?
I am trying to find out how I can use:
grep -i
With multiple strings, after using grep on another command. For example:
last | grep -i abc
last | grep -i uyx
I wish the combine the above into one ...
0
votes
1
answer
2k
views
Writing in the file descriptor of the child process (fd/0)
I'm playing with file descriptors in my CentOS 7 sandbox. In doing so, I noticed an interesting situation. Suppose we've a simple PHP script:
$step = 4 * 1024;
echo "php started\n";
while (!...
2
votes
1
answer
989
views
Piping output from GitHub clone using tee misses output
I thought I would log the output of cloning a GitHub repo to a file. If I run
git clone [email protected]:my_repo/my_repo.git | tee -a log
I get an empty log file, but the following output to the ...
0
votes
2
answers
8k
views
How to pipe a file as input to tar command
I get the following error when trying to uncompress piped tar file with the following command :
$ git archive --format=tar 0af62b1 | tar -xf -C /the/path/here/
tar: -C: Cannot open: No such file or ...
2
votes
1
answer
1k
views
Gnuplot: What is the difference between plot '/dev/stdin' and plot '-'?
When I use '-' to plot in gnuplot from a pipeline, as follows⭐:
$ seq 5 | gnuplot -e "plot '-' w lp; pause 99"
it works fine, I can adjust the plot's window size, can show/hide grid without ...
5
votes
3
answers
2k
views
Pipe globs to ls
Contents of file filelist:
/some/path/*.txt
/other/path/*.dat
/third/path/example.doc
I want to list those files, so I do:
cat filelist | xargs ls
But instead of expanding those globs, I get:
ls: ...
4
votes
1
answer
688
views
PIPESTATUS variable is empty
I'm working on a Linux server and noticed that the PIPESTATUS array variable is always empty.
I'm on bash v4.1.2(1)-release
$ echo $BASH_VERSION
4.1.2(1)-release
$ false | true | false
$ echo ${...
1
vote
1
answer
406
views
process hangs after redirecting stderr using exec
I want to redirect stdout and stderr to 2 pipes one for each
to create the pipes I used:
mkfifo -m 0666 /var/run/log_stdout.pipe
mkfifo -m 0666 /var/run/log_stderr.pipe
and it works fine, but ...
0
votes
1
answer
433
views
How can I pipe stdout to another process, whilst also capturing stdout in a local file?
With a command as follows:
program_that_produces_stdout | program_that_captures_stdout
I would like to capture the output of program_that_produces_stdout in a file locally too.
Obviously
...
0
votes
1
answer
345
views
Cache stdout data and forward it stdout
I am running a command line tool in Linux that emits data every 10ms. I'll forward this to another application to visualize the data. I would like to cache for example 10 incoming messages from stdin ...
0
votes
1
answer
680
views
Is there a way to overwrite pipe on linux bash?
I was wondering if there is a way to replace the default behavior of the | command in bash with a custom command. I would like overwrite the pipe command.
This is a strictly technical and ...