shell usage (syntax) question

Erik Trulsson ertr1013 at
Sat Aug 27 14:48:16 GMT 2005

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 at

More information about the freebsd-questions mailing list