Neil Bothwick <[EMAIL PROTECTED]> wrote: > On Wed, 26 Sep 2007 10:14:58 +0200, Alexander Skwar wrote: > >> Back to tar: Why use "tar -j" in scripts, when "bzip2 | tar" >> does the same thing? I very much disagree that "tar -j" is >> the "better" option here; > > Either way requires that you first determine the type of compression used > before you can decide where to pipe tar's output, if at all. Whereas > something like "tar xf somefile" avoids the need to do" file somefile" > and parse the output first.
Pardon? "tar xf somefile" doesn't do any compression at all. I don't get what you mean. >> in fact, I'd say that "bzip2 | tar" >> is the better option, as it works on a lot more systems than >> "tar -j" does. Heck, "tar -j" even does not work on all GNU >> tar implementations, as very old GNU tars don't have bzip2 >> support at all and -j wasn't always used for bzip2. > > If you don't know the details of the platform running your script, you > should of course stick to POSIX, which tar can do fine. No, GNU tar is not completely POSIX compliant. The files it creates don't completely comply to the standard. But that's another story. > But if your > script in running in an environment you control, why not make use of more > efficient methods? If there are more efficient methods: Maybe. But if the non standard options aren't more efficient, why use them at all? "tar -j" is a good example here: Internally, tar invokes the external "bzip2" command. So with "tar | bzip2" vs. "tar -j", both are equally efficient. Alexander Skwar -- [EMAIL PROTECTED] mailing list