Tagged Questions
1
vote
1answer
48 views
Shell script detecting errors from command called by script
I am calling applications from my shell script, which performs a number of important steps in sequence, one step being below:
for database in $(
echo 'show databases;' |
mysql ...
1
vote
1answer
172 views
How to redirect multiple bash commands to a variable AND screen?
I would like to capture a subshell's output in a variable and print it in the terminal screen simultaneously. Is it possible to do this by assigning the subshell to a variable and piping stdout and ...
0
votes
2answers
134 views
Linux output redirection not working with awk
I'm trying to write a nice csv-file based on some output from top. I reformat the output with awk like this:
top -b | nawk '/Cpu/ || /Tasks/ { if($1 ~ /Cpu/) { printf "%s,",$3 } else { printf "\n" } ...
2
votes
1answer
347 views
Unix bidirectional pipe on commandline
I've been able to use this linux command to connect Netcat to a serial port:
nc -l 80 <> /dev/ttyS0
I would like to be able to log this transaction. My backup plan is to use Wireshark to ...
2
votes
2answers
4k views
In windows, can I redirect stdout to a (named) pipe in command line?
Is there a way to redirect the standard output of a process in Win32 console to a named pipe?
Named pipes are built in to Windows and while they would be an useful concept, I've never seen them used ...
1
vote
1answer
115 views
redirecting output from several piped commands
This works:
find . -type f | xargs md5sum | sort
This does not and gives several "md5sum: xyz not found" errors:
( find . -type f | xargs md5sum | sort ) >~/md5.txt
Same for:
find . -type f ...
3
votes
1answer
500 views
Linux: redirecting stdout and stderr
I want to write stdout to a file but also prints stdout and stderr. I tried using tee:
prog | tee stdout.txt
but this causes the printed stderr and stdout to be interleaved incorrectly, i.e. if the ...
4
votes
1answer
464 views
Is backwards redirection the same as a pipe?
In Linux if you type
sort < txtfile
is that the same thing as
cat txtfile | sort
2
votes
4answers
937 views
How to redirect the output of a program to the linux diff command
I have a program that writes to stdout. Is there a way that I can redirect the output to the linux diff command or do I have to write the output to a file and then compare that. For example I have a ...
0
votes
3answers
258 views
Command output redirection to vim not working on OS X
I'm trying to redirect the output of a command to vim using the - argument, but it doesn't seem to work on OS X. For example, if I type
$ ls | vim -
on the command line on one of my Linux ...
8
votes
3answers
7k views
cURL: how to suppress strange output when redirecting?
I'm trying to print just the verbose sections of a cURL request (which are sent to stderr) from the bash shell.
But when I redirect stdout like this:
curl -v http://somehost/somepage > /dev/null
...
2
votes
1answer
84 views
How to construct shell redirection on command line
Consider the following command in Unix:
echo 0123456789 | cat >/tmp/foo &> /tmp/bar
The echo is sent to /tmp/bar.
However, what I really want is to redirect the stdout and stderr output ...
