[root@localhost /]# ( ./address_to_char;cat) | ./overflow
How does ( ./address_to_char;cat)
work here?
What's different from ./address_to_char|./overflow
?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this community[root@localhost /]# ( ./address_to_char;cat) | ./overflow
How does ( ./address_to_char;cat)
work here?
What's different from ./address_to_char|./overflow
?
The outputs of both ./address_to_char
and cat
are piped to ./overflow
as a single, continuous stream of data.
First, ./address_to_char
is run, and its output is redirected to ./overflow
's input.
When ./address_to_char
exits, cat
is started, and its output is attached to the still-running ./overflow
process in the same way.
Since cat
was run with no files specified, it reads from stdin (in this case, your keyboard).
cat
exits upon reaching the end of its input. In this case, it reads from keyboard, and will exit when you press the "EOF" key (by default Ctrl-D).
./overflow
exits,weird...or is that normal?
./overflow
) exits, the left side doesn't have anywhere to write to, and -- AFAIK -- gets killed by signal SIGPIPE
.
./overflow
get executed before cat
exits?
Well the parentheses open a sub shell and the semi colon will run the commands sequentially.
So in this case, you are running ./address_to_char
then cat
in a subshell.
./address_to_char | ./overflow
,right?