[NTLUG:Discuss] More named pipes "fun"

Leroy Tennison leroy.tennison at verizon.net
Wed May 22 16:58:11 PDT 2024


After Saturday's presentation I discovered a new strange result today, if you run
exec 7 <>xfr
(where xfr is a named pipe but there's a space between the 7 and the less-than sign)
the terminal not only becomes an input to all named pipe content but there is an attempt to execute whatever is sent (try 'echo "ls -al" > xfr' or 'echo "df -h" > xfr' from another terminal).  However, anything typed in that terminal seems to go nowhere.  The classic is "echo Ctrl-D > xfr" (where Ctrl-D is [produced with Ctrl-v followed by Ctrl-d) - the terminal session exits.
However, if
exec 7<>xfr
(note no space between the 7 and the less-than) is used not only does the terminal remain a "normal" terminal, if data is read from the pipe in that terminal it becomes just data.
If an attempt to use just < or > is attempted in the top example things are equally odd (but somewhat different).
Enjoy and take care...


More information about the Discuss mailing list