[plug] Backups
Richard Sharpe
sharpe at ns.aus.com
Thu Jul 6 22:31:25 WST 2000
While it is bad form to comment on one's own posts, I wanted to expand on
my last, rather terse answer.
At 11:09 PM 7/6/00 +0900, Richard Sharpe wrote:
>At 05:06 PM 7/8/00 +0800, Jason Nicholls wrote:
>>Hiya,
>>
>>On Sat, Jul 08, 2000 at 04:47:32PM +0800, Earnshaw, Mike wrote:
>>> List,
>>>
>>> When I try to tar to a scsi tape with:
>>>
>>> tar -czf filename.tar /mnt/cad | /dev/st0
>>
>>shouldn't that last pipe be a redirector (ie: '>')?
>
>No! To use redirection, do:
>
> tar -czf - /mnt/cad > /dev/st0
This is an example of a common idiom in UNIX. A file name give as - means
stdin or stdout as appropriate.
You can do things like:
tar zcf - /mnt/cad | (cd /some/where/else; tar zxf -)
Which runs tar and sends its output to stdout via -, piped into a tar
taking its input from stdin via -.
Now, for the bonus question, why do I have the RHS of the pipe in brackets?
Regards
-------
Richard Sharpe, sharpe at ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
Co-author, SAMS Teach Yourself Samba in 24 Hours
Author: First Australian 5-day, intensive, hands-on Linux SysAdmin course
Author: First Australian 2-day, intensive, hands-on Samba course
More information about the plug
mailing list