Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mcnc!rti!trt From: trt@rti.rti.org (Thomas Truscott) Newsgroups: comp.misc Subject: Re: Your favourite UNIX-pipe (summary) Summary: && is often better than ; Message-ID: <4002@rtifs1.UUCP> Date: 3 Aug 90 20:55:15 GMT References: <730@coma.UUCP> <2987@awdprime.UUCP> <2400@dino.cs.iastate.edu> Organization: Research Triangle Institute, RTP, NC Lines: 18 > Here's a good one (stolen from an Ultix man page): > (cd fromdir; tar cf - .) | (cd todir; tar xpf -) I have learned that (cd fromdir && tar cf - .) | (cd todir && tar xpf -) is a safer form of this command. Guess how I learned :-) In general, use "a && b" rather than "a ; b" if you only want to do "b" if "a" succeeds. Some versions of /etc/rc have a line to delete trash from /tmp: (cd /tmp; rm -f *) # Not recommended I wonder what happens if /tmp is inadvertently missing, or mode 0? I guess it just deletes trash in some other directory :-) (rm -f /tmp/*) # Recommended seems wiser, particularly since files in /tmp can be named "-r" or "-i". Tom Truscott