Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ 1 [2] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: No Bash Command Substitution?!, Missing /dev/fd/ files< Next Oldest | Next Newest >
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Jan. 08 2008,16:13 QUOTE

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?


Edited by roberts on Jan. 08 2008,16:18
Back to top
Profile PM WEB 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Jan. 08 2008,17:00 QUOTE

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
Back to top
Profile PM 
chaostic Offline





Group: Members
Posts: 328
Joined: Mar. 2005
Posted: Jan. 08 2008,19:46 QUOTE

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
Back to top
Profile PM 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Jan. 08 2008,21:08 QUOTE

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.
Back to top
Profile PM 
8 replies since Jan. 07 2008,06:48 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ 1 [2] >/
reply to topic new topic new poll
Quick Reply: No Bash Command Substitution?!

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code