Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Aug 2005 16:48:13 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Emanuel Strobl <Emanuel.strobl@gmx.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: shell usage (syntax) question
Message-ID:  <20050827144813.GA22941@falcon.midgard.homeip.net>
In-Reply-To: <200508271525.37192@harrymail>
References:  <200508271525.37192@harrymail>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 27, 2005 at 03:25:27PM +0200, Emanuel Strobl wrote:
> Hello,
> 
> how can I delimit a program parameter from a shell instruction?
> Example: I want to tell the shell that stderr should be redirected to 
> file /tmp/test, not cpio to use /file/test:
> 
> # /usr/bin/cpio -idmuv < /dev/ad0h 2> /tmp/test
> 
> This doesn't work, I guess cpio grabs the ">". How can I write it that the 
> shell sees the ">"? (sh, but also interesting for csh)

The example you give above *is* the correct syntax for having stderr of
'cpio' redirected to /tmp/test (instead of to the tty as is the normal case.)

The shell reads and takes care of all the redirection stuff before starting
the program.  In the example above 'cpio' will not see the 
"< /dev/ad0h 2>/tmp/test" part of the commandline, since the shell will not
pass it along to the program.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050827144813.GA22941>