home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!darwin.sura.net!eng.ufl.edu!news
- From: ruck@zeta.ee.ufl.edu (John R Ruckstuhl Jr)
- Subject: Bourne shell I/O
- Message-ID: <1992Nov10.235519.3857@eng.ufl.edu>
- Sender: news@eng.ufl.edu (Usenet Diskhog System)
- Organization: EE Dept at UF
- Date: Tue, 10 Nov 92 23:55:19 GMT
- Lines: 29
-
- On several occasions, I've seen posters to comp.unix.shell claim that
- there is no need to create temporary files in Bourne shell scripts --
- that proper use of redirection and the available file descriptors
- (0-9 ?) are a better way to shuffle temporary data.
-
- I'm studying the man pages and I'm having trouble seeing how this works.
-
- Suppose I want to process stderr, then process stdout
- The solutions I see must use a tempfile.
-
- e.g.:
-
- $ (echo one >&1; echo two >&2) 2>&1 > tempfile | sed 's/^/stderr /'
- stderr two
- $ sed 's/^/stdout /' tempfile
- stdout one
- $ rm tempfile
-
- Do any of you know how to use redirection cleverly to avoid creating
- (explicitly) tempfiles?
- Or do you think I've misunderstood what the posters meant.
- Heck, there must be a reason for the extra file descriptors, right?
-
- Thanks very much,
- ruck
- --
- John R. Ruckstuhl, Jr. ruck@alpha.ee.ufl.edu
- Dept of Electrical Engineering ruck@cis.ufl.edu, uflorida!ruck
- University of Florida ruck%sphere@cis.ufl.edu, sphere!ruck
-