[root@localhost /]# ( ./address_to_char;cat) | ./overflow
How does ( ./address_to_char;cat)
work here?
What's different from ./address_to_char|./overflow
?
[root@localhost /]# ( ./address_to_char;cat) | ./overflow
How does ( ./address_to_char;cat)
work here?
What's different from ./address_to_char|./overflow
?
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
thencat
in a subshell.The outputs of both
./address_to_char
andcat
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).