Difference in bash output redirections behavior
0
votes
2
answers
68
views
I am trying to understand the reason behind the difference in redirections of bash output. Here are two approaches:
1) Redirection of the output to named pipe:
/bin/bash -i 2>&1 1>/tmp/fifo
2) Redirection using unnamed pipe to another script reading from stdin: /bin/bash -i 2>&1 | ./reader.sh
_reader.sh_ is supposed to read line by line from stdin:
while read LINE; do
echo ${LINE} # do something with it here
done
exit 0
The question is: Why when redirecting to fifo (approach#1) the prompt information (username@host: $) is not redirected, but when redirecting to another program/script (approach#2), it does?

Asked by Pauloss
(1 rep)
Sep 16, 2024, 06:34 PM
Last activity: Sep 17, 2024, 02:04 PM
Last activity: Sep 17, 2024, 02:04 PM