From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 9 05:18:17 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9BBCF16A4CE for ; Fri, 9 Jan 2004 05:18:17 -0800 (PST) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E05843D54 for ; Fri, 9 Jan 2004 05:18:14 -0800 (PST) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])i09DH8L11483; Fri, 9 Jan 2004 14:17:08 +0100 (MET) Date: Fri, 9 Jan 2004 14:17:08 +0100 (CET) From: Harti Brandt To: Markus Brueffer In-Reply-To: <200401091407.48104.brueffer@phoenix-systems.de> Message-ID: <20040109140945.E16150@beagle.fokus.fraunhofer.de> References: <20040108181346.84AE116A4E0@hub.freebsd.org> <200401091127.18780.RoKlein@roklein.de> <200401091407.48104.brueffer@phoenix-systems.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org cc: j.el-rayes@daemon.li Subject: Re: freebsd-hackers Digest, Vol 42, Issue 6 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jan 2004 13:18:17 -0000 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 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