User Feedback :: No Bash Command Substitution?!



They are pipes. Should be created by bash.

echo >(true)

diff <(ls -l) <(ls -a)

comm <(ls -l) <(ls -al)

sort -k 9 <(ls -l /bin) <(ls -l /usr/bin) <(ls -l /usr/X11R6/bin)

These all work fine for me.

Note bash in DSL is v2.05b, perhaps your requirements need a higher bash version?



Quote (roberts @ Jan. 08 2008,11:13)
They are pipes. Should be created by bash.

echo >(true)

diff <(ls -l) <(ls -a)

comm <(ls -l) <(ls -al)

sort -k 9 <(ls -l /bin) <(ls -l /usr/bin) <(ls -l /usr/X11R6/bin)

These all work fine for me.

Note bash in DSL is v2.05b, perhaps your requirements need a higher bash version?

Initially didn't work for me either; so I found this:

Repeat-By:
   # Check that devfs(5) is mounted on /dev and execute a command
   # that uses process substitution.
   $ mount | grep devfs
   devfs on /dev (devfs, local)
   $ diff <(cat /etc/group)  <(cat /etc/group)
   diff: /dev/fd/63: No such file or directory
   diff: /dev/fd/62: No such file or directory
   $ ls /dev/fd
   0    1    2

Hmm. Weird. I got it working.
Somehow
cat Events | tee >(grep -i "Linux" > test.txt)
is different then
cat Events >(grep -i "Linux" > test.txt)

This now works:
cat vlchelp | tee >(grep -i interface > test12.txt) >(grep -i log > test13.txt) | grep -i http
i.e. three outputs from one file read :D

Edit:
Looking at how process substitution works (both forwards and backwards) I know why cat wasn't working.
cat Events >( grep -i "Linux" > test.txt)
Is actually
cat Events /dev/fd/63
is
cat filename filename
Even though >() should be a pipe, but since cat wasn't meant to take an output file argument, just input file arguments.

Edit2:

I have no devfs mounted on /dev, especially since dsl has a static /dev, no?
Only devfs is usbdevfs

Quote (chaostic @ Jan. 08 2008,14:46)
Edit2:

I have no devfs mounted on /dev, especially since dsl has a static /dev, no?
Only devfs is usbdevfs

Hm....seemed to work before, but haven't been able to replicate it.

original here.