Date: Fri, 9 Jan 2004 14:17:08 +0100 (CET) From: Harti Brandt <brandt@fokus.fraunhofer.de> To: Markus Brueffer <brueffer@phoenix-systems.de> Cc: j.el-rayes@daemon.li Subject: Re: freebsd-hackers Digest, Vol 42, Issue 6 Message-ID: <20040109140945.E16150@beagle.fokus.fraunhofer.de> In-Reply-To: <200401091407.48104.brueffer@phoenix-systems.de> References: <20040108181346.84AE116A4E0@hub.freebsd.org> <200401091127.18780.RoKlein@roklein.de> <200401091407.48104.brueffer@phoenix-systems.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 9 Jan 2004, Markus Brueffer wrote: MB>On Friday 09 January 2004 11:27, Robert Klein wrote: MB>> On Freitag, 9. Januar 2004 10:33, Josef El-Rayes wrote: MB>> > Lukas Ertl <l.ertl@univie.ac.at> wrote: MB>> > > On Fri, 9 Jan 2004, Josef El-Rayes wrote: MB>> > > > tar xvfj file.tar.bz2 MB>> > > MB>> > > tar xvjf .... MB>> > MB>> > i do not think that the order of the parameters MB>> > have any influence on the result. MB>> MB>> No, but the filename has to be right after the f. The following MB>> commands work, and both have the same result: MB>> MB>> tar -jxvf file.tar.bz2 MB>> tar -jxf file.tar.bz2 -v MB>> MB>> but the following does not work as you expect: MB>> MB>> tar -jxfv file.tar.bz2 MB>> MB>> In this command tar(1) tries to extract the file "v". MB>> MB>> Example error message: MB>> $ tar -jtfv xfce-4.0.1-src.tar.bz2 MB>> tar (child): v: Cannot open: No such file or directory MB>> tar (child): Error is not recoverable: exiting now MB>> tar: Child returned status 2 MB>> tar: xfce-4.0.1-src.tar.bz2: Not found in archive MB>> tar: Error exit delayed from previous errors MB>> $ MB> MB>Remove the "-" from the front of the options-list and it will work in your MB>last example. So Josefs statement was correct. MB> MB>What I'm asking me, is why the "-" makes a difference, though I haven't looked MB>at the sources, yet. The manpage states, that the "-" is only optional, so MB>"tar -jxfv" and "tar jxvf" should be equivalent, but obviously they are not. Old tar (v7) and Posix (well, SUSv2) have no dash before the key (the first argument to tar). They take option values from the next arguments in the order the options appear in the key string: tar xfbv file.tar 20000 x - no arg f - take next arg (file.tar) b - take next arg (20000) v - no arg. Using a dash is a gnu-ism and should be avoided in scripts. harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040109140945.E16150>