Capturing tar output

perryh at pluto.rain.com perryh at pluto.rain.com
Thu Sep 11 08:41:24 UTC 2008


> > redirect stderr with "2>" operator
> >
> Using the following command,
> # /usr/local/gtar/bin/tar -cvf - /home/hallja 2 > /var/log/test.txt |
> /usr/local/bin/gpg --encrypt "recipient" | dd of=/dev/nsa0 obs=128k
>
> I receive an error meesage stating, "Ambiguous output redirect."

Wojtek correctly pointed out that there should be no space between
the 2 and the >, but I suspect the primary problem is that "2>" is
Bourne/Korn/Bash syntax and your root shell is most probably csh.

Does it work any better if you first start /bin/sh:

# sh

sh will give you another # prompt, and then it should work:

# /usr/local/gtar/bin/tar -cvf - /home/hallja 2> /var/log/test.txt | /usr/local/bin/gpg --encrypt "recipient" | dd of=/dev/nsa0 obs=128k

After it finishes, and sh prompts again:

# ^D

The Ctrl-D will exit from sh, returning to the csh prompt.


More information about the freebsd-questions mailing list