On Sun, Oct 07, 2007, Arby wrote:
>OS: SCO Osr 5.0.7 with Maintenance Pack 5
>
>I'm trying to,write a Bourne script that I can use to backup files. I hope
>to redirect cpio's verbose output to a file, for later comparison with an
>earlier file that contains the filenames that I wish to backup. In the
>following script, cpio send its verbose outrput to the console, instead of
>to the file named "backnames". Can anyone tell me why?
Most likely because the output is to standard error, not standard output.
>cat backnames | cpio -ocaBv -C65536 -O/dev/mt \
>-K7990000 > /tmp/backnames
This would be self-destructive as the command would empty
/tmp/backnames on startup, and could also be considered an
example of useless use of the cat command
Should be:
cpio -ocaBv -C65536 -O/dev/mt -K7990000 < /tmp/backnames > /tmp/cpioout 2>&1
The part ``2>&1'' joins standard output and standard error into a
single file stream.
Bill
--
INTERNET:
bill@celestial.com Bill Campbell; Celestial Software LLC
URL:
http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
What's this script do?
unzip ; touch ; finger ; mount ; gasp ; yes ; umount ; sleep
Hint for the answer: not everything is computer-oriented. Sometimes you're
in a sleeping bag, camping out.
(Contributed by Frans van der Zande.)