Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!sdd.hp.com!uakari.primate.wisc.edu!zazen!uwvax!margay.cs.wisc.edu!dws From: dws@margay.cs.wisc.edu (DaviD W. Sanderson) Newsgroups: comp.unix.shell Subject: Re: Wierd shell bug could be useful Summary: useful, but not a bug Message-ID: <1991Jan30.211715.16547@spool.cs.wisc.edu> Date: 30 Jan 91 21:17:15 GMT References: <618@tndsyd.oz> Sender: news@spool.cs.wisc.edu (The News) Organization: U of Wisconsin CS Dept Lines: 31 In article <618@tndsyd.oz> root@tndsyd.oz (the main man) writes: >Try this out: > $ echo > foo ' > > garbage > > ... > > ' [...] >A user friendly bug !!! It isn't a bug. The shell allows i/o redirections to occur anywhere on the command line (it even says so in the man page), and it also allows multiline quoted strings. So the example you gave was simply an echo of a single quoted string redirected into a file. Putting the redirection in the middle is unusual but perfectly legal. You could equally well have given $ > foo echo ' or $ echo ' junk junk ' ' > foo Note that if you substitute "cat" for "echo" you will get an error from cat because presumably cat will not be able to find a file whose name is given by the multiline quoted string. Unless you like pathological file names! :-) -- ___ / __\ U N S H I N E DaviD W. Sanderson | | | I N E dws@cs.wisc.edu _____| | |_____ ________ \ / \ |__/ /////__ Fusion Powered Locomotives Made to Order \____/ \__|_/ \\\\\______ (TARDIS model available at extra cost)