From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7e4c861d0e6e737cdef79daa6ba6f4a2@collyer.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] dumb question From: Geoff Collyer MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Fri, 5 Jul 2002 02:43:55 -0700 Topicbox-Message-UUID: c2e65574-eaca-11e9-9e20-41e7f4b1d025 > i have also damaged whole file trees by doing > 'tar cf adir - | {cd /missspelled/dir; tar xf -}' I did too, a long time ago, and the lesson I drew is: you shouldn't use "cd directory; tar", you should write cd directory && tar . In shell scripts, the shell will generally exit if cd fails, but obviously interactive shells don't. On Plan 9 at least, you can avoid destroying the archive (at least by confusing "c" and "x") by not using the "f" key letter and letting tar read standard input and write standard output, thus: tar c >tarfile afile tar x " mixed up, which seems less likely. If it's that much of a problem, protect your archives ("chmod a-w tarfile").