[lug] Subshell behavior with potato bash?

socket at peakpeak.com socket at peakpeak.com
Thu Jan 20 09:45:08 MST 2000

Since I upgraded to debian potato a month ago or so, an upgrade of
bash (or perhaps grep) started breaking a declaration in my

Here's the relevant line:

f="$(who | grep $(tty | sed s./dev/..))"

I'm currently running:

GNU bash, version 2.03.0(1)-release (i386-pc-linux-gnu)
grep (GNU grep) 2.4
GNU sed version 3.02
who, tty (GNU sh-utils) 2.0

Here's the error:
grep: a: No such file or directory
grep: tty: No such file or directory

I can probably fix this myself if someone could explain just what a $
before () does.  I would assume that it might be the return value of
the subshell, when the subshell finishes, maybe the output of the
subshell... this little quirk doesn't seem easily explainable.

Identical line works fine under bash 2.01.1(1)-release
(i486-pc-linux-gnu) that comes with slink.

Any thoughts?  Thanks!

Chris Riddoch                  socket at peakpeak.com
Will provide pseudo-insightful commentary for food

GPG key 1024D/234551DC 1999-07-15 Chris Riddoch <socket at peakpeak.com>
Key fingerprint = 7AAF 5815 837C 070C 6C70  8A15 EFD2 5860 2345 51DC

More information about the LUG mailing list