LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] vanquishing the daemons of shell scripting

[ILUG] vanquishing the daemons of shell scripting

Stephen Shirley diamond at skynet.ie
Sat Jul 20 10:48:08 IST 2002


Mornin' all,
	Last night, i was involved in an epic struggle to write a shell
script to do a certain task. The battle raged for hours, but, i'm glad
to inform you, i emerged victorious. The problem was as follows:
	It's very easy to get one program to act on the output of a second
program: cmd1 | cmd2. But, what if you want cmd1 to act on the output of
cmd2 as well? Hmm. Eventually, I came up with this solution:

	mkfifo io
	cmd1 <io | cmd2 > io
	
and bingo, all was well with the world. Now, I have (and had) a sneaking
suspcion that it might be possible to do this without using a fifo, and
can be done using something like:

	exec 3>&1
	cmd1 <&3 | cmd2 >&3
	exec 3>&-

but that doesn't work in that form, and i couldn't work out an
incantation that would. Anyone got any suggestions? Anyway, victory is
mine, and i is happy person once again. In case you were wondering, the
aim of all of this was to write a shell script that could check for new
mail on an imap server.

Steve
-- 
"Oh look, it's the Pigeon of Love."




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell