Tagged Questions
2
votes
1answer
34 views
redirection to file issues with nohup and pipe
for the following script
ssh -t esolve@hostname 'sudo nohup bash -c "ls > log 2>&1 &"'
I always got error information:
nohup: ignoring input and appending output to ...
0
votes
2answers
118 views
Redirecting stdin with stdout to file
So I have a program that takes in user input and outputs text based on the input.
EDIT2: I want to create a script that runs a C executable and the script feeds the C program input from a file and ...
3
votes
4answers
81 views
Getting stdin from a named pipe
What I am trying to do is run python in a terminal window and redirect it's stdin from a named pipe. Then I write to the named pipe in another terminal and have that command execute on python.
...
2
votes
1answer
73 views
Stderr of piped shell scripts isn't always displayed
I piped my own shell scripts for some testing and accidentally noticed something strange. Namely, the stderr of those piped processes isn't always displayed on the screen.
I simplified the scripts ...
2
votes
4answers
250 views
How to pipe the stdout to a file if the current command is already being piped through gzip
So I have this command I need to run then disown:
innobackupex-1.5.1 --user=root --password=**** --stream=tar ./ | gzip - > /data/myfile.tar.gz
How do I pipe any output to a file?
adding ...
2
votes
1answer
111 views
How to copy the output of pacman-color into a file and to display the output with the colors in the terminal
Originally I used pacman, not pacman-color and I copied the output into a file and I displayed the output in the terminal with the following command :
pacman -Syu | tee file.log
Unfortunately, it ...
2
votes
4answers
114 views
store and execute redirection/piped command in script
How do you store, and later execute, a command with redirection and and a pipe? (And is it the pipe, or the redirection, or both, that's causing my problem?)
I tried to print the urxvt version in a ...
6
votes
1answer
244 views
echo vs <<<, or Useless Use of echo in Bash Award?
By now the Useless Use of cat Award is very well known, and there's also a mention of a Useless Use of echo (not relevant for this question). I'm wondering if there should be a "Useless Use of echo in ...
2
votes
3answers
359 views
Count running processes using wc and ps
I tried using ps r > log | wc log but this returns Ambiguous output redirect..
Can someone explain why and provide another solution?
1
vote
1answer
83 views
What is the difference between who > lp and who | lp?
Why does the who > lp creates a file but who | lp leads the output to program lp?
What is the underlying principle behind these two simple commands?
Can somebody explain it with an example?
1
vote
2answers
297 views
Print/Tee to console without passing output to pipe
Is there a way to print or tee one thing to the console and still pass something else through to the next pipe? Something like:
echo dog | printOrWhatnot "PUTTING MY THING DOWN" | sed 's/dog/cat/g' | ...
19
votes
6answers
1k views
Why can't I redirect a path name output from one command to “cd”?
I am trying to get cd to accept a directory name redirected to it from another command. Neither of these methods work:
$ echo $HOME | cd
$ echo $HOME | xargs cd
This does work:
$ cd $(echo $HOME)
...
2
votes
2answers
875 views
What's the difference between STDIN and arguments passed to command?
I could use the either form to execute the cat method:
cat file_name
cat < file_name
The result is the same
Then I want to execute man in the format of STDIN
man < file_name
For the ...
0
votes
1answer
157 views
The “cp p2 &2 &” command makes Konsole to disappear, is it a bug?
The goal is start a background process that copies the data from the pipe p2 to the STDOUT as p2 is feed with data by some other process.
I guess the command is incorrect. Nevertheless, the Konsole ...
3
votes
2answers
333 views
Behavior of stdin/stdout in conjunction with subshells and cd command
I have the following series of commands:
cd / && ls | ( cd /tmp && cat >dumpfile)
This series of commands does the following: it creates a file named /tmp/dumpfile. This file ...
79
votes
2answers
3k views
Bash: What does “>|” do?
I have just seen this written down;
$ some-command >| /tmp/output.txt
Vertical pipes are used in standard redirects "piping" the output of one command to another, is >| in fact completely ...
2
votes
1answer
74 views
pipe and log STDOUT at the same time
Some programs output very detailed data, for readability I use awk to filter them.
./output_many_things | awk '{print $1 "\t" $2}'
But I don't want to miss anything. Could I redirect the complete ...
4
votes
1answer
180 views
command like wc but with tee behaviour
I want to backup a database using psql and COPY command. here is my script:
psql "user=${USERNAME} host=${HOSTNAME} dbname=${DBNAME} password=${PASSWORD}" -c \
"COPY (SELECT * FROM tbl) ORDER BY id ...
5
votes
2answers
2k views
what is meant by connecting STDOUT and STDIN?
This is a newbie question. I'm reading a book, it says:
Every process has at least three communication channels available to it: “standard
input” (STDIN), “standard output” (STDOUT), and ...
11
votes
3answers
1k views
How can I pipe output to another process, but retain the error state of the first process? [duplicate]
Possible Duplicate:
Get exit code of process that's piped to another
I am using the following command line (in a makefile) to pipe the verbose error messages from my compiler through a ...
7
votes
3answers
371 views
Piping STDERR vs. STDOUT
According to "Linux: The Complete Reference 6th Edition" (pg. 44), you can pipe only STDERR using the |& redirection symbols.
I've written a pretty simple script to test this:
#!/bin/bash
echo ...
6
votes
3answers
2k views
Non-blocking buffered named pipe?
I'm looking for something I suspect doesn't exist: A non-blocking buffered named pipe (fifo) for use from the command line. Is there such a thing?
Here's the use case: Suppose I have a process that's ...
3
votes
3answers
553 views
Create a temporary file from a stdout redirect or pipe
Some commands only output to stdout.
Some tools only work on files.
Is there a command that can glue those together?
Contrived simple example:
diff $(echo 1 | stdout-to-temp-file) $(echo 2 | ...
2
votes
2answers
539 views
Difference between > and | with /dev/tty
When I run this command:
echo "1" > /dev/tty # runs successfully
but when I run this:
echo "1" | /dev/tty #permission denied
What is the difference between these two operators > and | and ...
8
votes
4answers
3k views
Difference between 2>&1 > output.log and 2>&1 | tee output.log
I wanted to know the difference between the following two commands
2>&1 > output.log
and
2>&1 | tee output.log
I saw one of my colleague use second option to redirect. I know ...
3
votes
2answers
491 views
Performance difference between stdin and command line argument
For some commands, it is possible to specify certain input as either stdin or a command line argument.
Specifically, suppose command can take stdin input and a filename as command line argument, and ...
14
votes
4answers
1k views
Process substitution and pipe
I was wondering how to understand the following:
Piping the stdout of a command into the stdin of another is a powerful
technique. But, what if you need to pipe the stdout of multiple
...
0
votes
1answer
182 views
Is 'some_program <some_file' faster than 'cat some_file | some_program'? [duplicate]
Possible Duplicate:
Should I care about unnecessary cats?
Both would be functionally equivalent, but when using cat wouldn't it be slower because you have a process first reading the file ...
3
votes
2answers
707 views
Why is piped input okay to zenity, but <file malfunctions?
My question is as simple as what the zenity --text args say in the example... but what is causing this 100% CPU grab by the redirection?
...(and by the way, is this particular usage of < actually ...
5
votes
2answers
496 views
redirection and pipeline
I was wondering about differences and relation between redirection and pipeline.
Is pipeline only used to connect
stdout output of a command to stdin
input of another command?
Is redirection only ...
6
votes
3answers
3k views
Redirect stdout over ssh
I would like to run
something > file
on a remote system through ssh, but if I run
ssh host something > file
the redirection is executed locally as ssh etc > file
I've tried it with ' ...
