News for hackers. Stuff that matters.
Re:Use long flags when scripting (2013) by adrianmonk on Friday September 18, 2020 @02:03PM (#24519938)
Great suggestion, but I'd go for a middle ground: use long flags for the long tail, but short flags are fine for stuff that's very commonly used.

I think I'll continue to write these:

    grep -i
    rm -rf
    ln -s
    gzip -v
    sed -e
instead of:

    grep --ignore-case
    rm --recursive --force
    ln --symbolic
    gzip --verbose
    sed --expression
If you're working on shell scripts, you probably know certain short flags well enough that long flags just add clutter and don't improve readability.
Re:Use long flags when scripting (2013) by ryanianian on Friday September 18, 2020 @02:51PM (#24520539)
The short flags are really there for when you're doing things interactively.

For scripts that are read and executed more often than they're written or changed, the long flags really help ensure you don't fat-finger.

I'm accustomed to typing `rm -rf` when really I just need `rm -r` in a lot of cases, and in PRs it's very easy for your eyes to glaze over when there's more than a single short flag.

Re:Use long flags when scripting (2013) by tedunangst on Friday September 18, 2020 @03:31PM (#24520966)
Why are you more likely to typo something in a script you can read, review, and test than an interactive command prompt that executes immediately?
Re:Use long flags when scripting (2013) by lukeck on Friday September 18, 2020 @07:16PM (#24522792)
I guess the differences are how long it takes to detect a typo, and therefore the blast radius in getting it wrong in a script that could be executed many times before you notice.
Re:Use long flags when scripting (2013) by jfrunyon on Friday September 18, 2020 @03:10PM (#24520754)
You literally always need -f with -r in a script (unless you want rm to prompt the user), though...
Re:Use long flags when scripting (2013) by jrimbault on Friday September 18, 2020 @03:39PM (#24521049)
You must have an alias rm='rm -i' lying around. rm doesn't prompt by default (unless you're the owner of the dir, but not its contents).

    mkdir demodir && touch demodir/{foo,bar} && rm -r demodir
Re:Use long flags when scripting (2013) by eMSF on Friday September 18, 2020 @03:57PM (#24521244)
IIRC 'rm -r' prompts by default for read-only files as well even if you own them.
Re:Use long flags when scripting (2013) by jfrunyon on Friday September 18, 2020 @04:18PM (#24521453)
... huh. No, no alias, I just misread the manpage.

I could've sworn that -I was the default......

Re:Use long flags when scripting (2013) by Macha on Friday September 18, 2020 @04:27PM (#24521547)
It's a common thing for IT departments or people making enterprise images to put in because they think it makes it safer.

I feel it does more harm than good by normalising rm -f when you want to recursively delete a folder, but with CD deployments these days it's less of a deal.

Re:Use long flags when scripting (2013) by mandelbrotwurst on Saturday September 19, 2020 @01:11AM (#24525297)
"CD deployments" - Ha, like an "ATM machine"? At first in thought you were describing deployments on compact discs!
Re:Use long flags when scripting (2013) by ninjanomnom on Saturday September 19, 2020 @03:41AM (#24525864)
CD, continuous deployment, is used to refer to the process not an individual instance like the term ATM. Simply saying "This deployment failed" doesn't convey that it's a deployment that was made through CD but "This CD failed" is also ambiguous as it doesn't indicate whether the process or the conditions particular to a deployment that caused it to fail. Using them both in combination like "CD deployment" seems perfectly valid to me to resolve both ambiguities.

To be fair though they were referring to CD deployment(s), plural, which is a bit redundant and just CD would have done just as well in this case.

Re:Use long flags when scripting (2013) by jfrunyon on Friday September 18, 2020 @04:40PM (#24521676)
Yeah... no. Also definitely not the case. If I actually am remembering it correctly then it's probably from Fedora circa FC5 or Ubuntu circa 6.06. Back when I was in school and had never touched Linux other than on my own computer.
Re:Use long flags when scripting (2013) by Macha on Friday September 18, 2020 @04:55PM (#24521804)
Go do a fresh install of CentOS/RHEL (or just spin up a new docker container) and what do you see in root's bashrc?

    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'
I've also encountered one job which adds this to their base ubuntu image, and my current employer uses Macs which have it added to bashrc by their mdm software on initial install.

So what's your justification to dismiss the idea that this is a common practice?

Re:Use long flags when scripting (2013) by matthewbauer on Friday September 18, 2020 @05:01PM (#24521854)
Aliases shouldn't be run in non-interactive shells IIRC.
Re:Use long flags when scripting (2013) by jfrunyon on Tuesday September 22, 2020 @12:12AM (#24550758)
I wasn't dismissing the idea that it was common practice, I was dismissing the idea that the common practice applied in my case. I did not have an IT department setting anything on my system when I experienced this.

Thank you for the info, though.

Re:Use long flags when scripting (2013) by gkop on Friday September 18, 2020 @02:05PM (#24519964)
Long flags aren’t just for readability, they also add entropy which contributes defensiveness against typos.
Re:Use long flags when scripting (2013) by UI_at_80x24 on Friday September 18, 2020 @04:59PM (#24521830)
And to add to your point, in my experience I've had "long-lived" scripts that the flags change meaning over the years. This is extremely rare on base-level installs, but frighteningly more common on the inhouse-programs I've had to deal with.

The long flags are less likely to be changed over time. The script will usually fail gracefully and I don't also need to relearn what I was thinking 25 years ago when I first did it. (long flags are like in-command comments too)

And as others have pointed out -v(ersion) or -v(erbose) can happen too.

Re:Use long flags when scripting (2013) by MaxBarraclough on Friday September 18, 2020 @03:23PM (#24520871)
Related to this, they're less likely to do something unexpected.

Many programs use -v as a short flag for --version, but some (such as curl) use it as short for --verbose

Probably something you'd catch pretty quickly, but still.

Re:Use long flags when scripting (2013) by ben509 on Friday September 18, 2020 @06:28PM (#24522473)
The worst (well known) offender is grep -v meaning grep --invert-match just for the sheer bafflement of "verbose" now hiding what you were looking for.
Re:Use long flags when scripting (2013) by u801e on Saturday September 19, 2020 @10:42PM (#24531596)
That actually comes from ed and vi. The g command would search for a line that matches a given regular expression and run the following command on that line. The v command was the inverse (search for lines that don't match the given regular expression).

The default command was to just print the line. Hence the name grep

g/re/p

Re:Use long flags when scripting (2013) by EE84M3i on Saturday September 19, 2020 @02:22AM (#24525584)
Wow, that's funny, I normally expect '-v' to be verbose, but maybe I just use a lot of `tar` and `curl`!
Re:Use long flags when scripting (2013) by mjochim on Saturday September 19, 2020 @07:48AM (#24526786)
Or maybe cp, or rm, or rsync, or mount, or wget, or netcat (both gnu and bsd) ... it’s really pretty reasonable to expect -v to mean verbose ;-).
Re:Use long flags when scripting (2013) by dpcx on Friday September 18, 2020 @04:38PM (#24521663)
As does Python, which drives me crazy. -V is version on Python.
Re:Use long flags when scripting (2013) by MaxBarraclough on Friday September 18, 2020 @04:52PM (#24521778)
Very annoying. Java HotSpot uses -version, rather than --version, which is even worse. Don't mess with the standard long-form flag!
Re:Use long flags when scripting (2013) by LukeShu on Friday September 18, 2020 @05:28PM (#24522057)
To be fair, the JVM predates GNU-style --long flags being "standard". Lots of older programs use "X11-style" -long flags (that many pre-X11 programs used, like `find`).
Re:Use long flags when scripting (2013) by tannhaeuser on Saturday September 19, 2020 @03:34AM (#24525843)
Long flags are a GNUism, not a "standard" by any means. The closest that comes to a standard in this space are POSIX utility conventions [1].

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1...

Re:Use long flags when scripting (2013) by hackerm0nkey on Friday September 18, 2020 @05:17PM (#24521960)
I get it wrong every damn time. 16 years and counting.
Re:Use long flags when scripting (2013) by iforgotpassword on Saturday September 19, 2020 @03:25AM (#24525818)
Same! Somehow I also start confusing this with somewhat related tools like gcc. It's rare enough that I need to query these that it's all blurry in my memory again by next time. "huh I guess gcc was that goofy one with just one dash.." Nope.
Re:Use long flags when scripting (2013) by nostoc on Friday September 18, 2020 @11:57PM (#24524888)
There's so much variation in flags for version, I've taken the habit of always using the long `--version` flag.
Re:Use long flags when scripting (2013) by jjgreen on Friday September 18, 2020 @07:27PM (#24522864)
... and it wrote the version to stderr up to 3.3, the stdout from 3.4; very convenient if you need to switch on version (which you do).
Re:Use long flags when scripting (2013) by fuzzer37 on Friday September 18, 2020 @04:26PM (#24521535)
But also contributes to the heat death of the universe.
Re:Use long flags when scripting (2013) by edoceo on Friday September 18, 2020 @04:28PM (#24521567)
what doesn't?
Re:Use long flags when scripting (2013) by ben509 on Friday September 18, 2020 @06:33PM (#24522505)
Nah, it's already happened, and we all pop up every 10^10^100 eons to pretend this is all real.
Re:Use long flags when scripting (2013) by arthurcolle on Friday September 18, 2020 @08:18PM (#24523295)
Shhh don't share meta content with the NPCs...
Re:Use long flags when scripting (2013) by nemetroid on Friday September 18, 2020 @03:53PM (#24521207)
I agree. To me, "sed -e" is an expression as a whole, and replacing -e with --expression is on the same level as aliasing "sed" to "stream-editor".

Though I would make the list of "allowed" short flags very short. I can't think of many more than the ones you listed:

  mkdir -p
  sh -c
  cp -r
  tar -xaf
  tar -caf
Re:Use long flags when scripting (2013) by kiwijamo on Friday September 18, 2020 @06:41PM (#24522548)
Is -a a GNU extension? Doesn't seem to be in the man page for BSD tar.
Re:Use long flags when scripting (2013) by Hello71 on Friday September 18, 2020 @07:40PM (#24522950)
it is, and it's unnecessary for decompression since GNU tar 1.21 according to a comment lower in the thread.
Re:Use long flags when scripting (2013) by lukeschlather on Friday September 18, 2020 @04:47PM (#24521746)
tar is one of the worst. I think I know what those do without looking it up but I think most people look at that with bewilderment. Randall Munroe is always helpful in these matters and has this to say: https://xkcd.com/1168/
Re:Use long flags when scripting (2013) by UI_at_80x24 on Friday September 18, 2020 @05:02PM (#24521861)
I remember 90% of the time which flag I want to use, but the other 10% sends me into a rage! =)

I gave up and added this to my .bashrc:

    function extract()      
  {
     if [ -f $1 ] ; then
         case $1 in
             *.tar.bz2)   tar xvjf $1     ;;
             *.tar.gz)    tar xvzf $1     ;;
             *.bz2)       bunzip2 $1      ;;
             *.rar)       unrar x $1      ;;
             *.gz)        gunzip $1       ;;
             *.tar)       tar xvf $1      ;;
             *.tbz2)      tar xvjf $1     ;;
             *.tgz)       tar xvzf $1     ;;
             *.zip)       unzip $1        ;;
             *.Z)         uncompress $1   ;;
             *.7z)        7z x $1         ;;
             *.zst)       zstd -d $1      ;;
             *.xz)        unxz $1         ;;
             *)           echo "'$1' cannot be extracted via >extract<" ;;
         esac
     else
         echo "'$1' is not a valid file"
     fi
}
Re:Use long flags when scripting (2013) by thequux on Friday September 18, 2020 @05:26PM (#24522041)
Recent (as in, within the last ~3-5 years) versions of GNU tar automatically detect the type of compression and apply the appropriate tool, so you can often get away with `tar xvf`.
Re:Use long flags when scripting (2013) by ahartmetz on Friday September 18, 2020 @07:11PM (#24522751)
Actually close to 12 years, GNU tar 1.21 https://www.gnu.org/software/tar/

Another "recent" (much more recent IIRC) change is that you don't need the dot anymore in find to search in the current directory.

Re:Use long flags when scripting (2013) by Hello71 on Friday September 18, 2020 @07:39PM (#24522941)
according to https://git.savannah.gnu.org/cgit/findutils.git/commit/find/..., this functionality has been present since findutils was moved under source control in 1996.
Re:Use long flags when scripting (2013) by jfrunyon on Tuesday September 22, 2020 @12:17AM (#24550788)
I believe that GNU find used to (in some cases?) show a warning if the directory was omitted. Could be wrong.
Re:Use long flags when scripting (2013) by mehrdadn on Friday September 18, 2020 @08:48PM (#24523635)
I think the dot actually gives you issues on Mac? Or something like that. I remember encountering issues with it.
Re:Use long flags when scripting (2013) by taejo on Saturday September 19, 2020 @04:24AM (#24526044)
You have to specify a directory for the find on Mac; it's only a GNUism to omit it.
Re:Use long flags when scripting (2013) by mehrdadn on Saturday September 19, 2020 @06:34AM (#24526455)
Oh I see, I got it backwards somehow. Thanks!
Re:Use long flags when scripting (2013) by Hello71 on Friday September 18, 2020 @07:45PM (#24522991)

  extract() {
    bsdtar -xf "$1"
  }
you can decompress things which are not files, such as stdin or device files. in addition, your code does not cover *.tar.xz (more common than tar.bz2 nowadays), or lzma, or lz4, or tar.zst, or many many other formats. further, it's not even consistent: bunzip2, gunzip, and unxz remove the input file, but tar, unrar, 7z, and zstd do not.
Re:Use long flags when scripting (2013) by rbonvall on Friday September 18, 2020 @07:10PM (#24522743)
There's a utility called dtrx ("do the right extraction") that does basically this, and also makes sure that files are always extracted into a directory.
Re:Use long flags when scripting (2013) by nobody9999 on Saturday September 19, 2020 @09:36AM (#24527326)
I can certainly understand the impulse to something like this, but as other posters pointed out, your case statement is incomplete, and will continue to become more so as new tools become available.

Personally, I consciously avoid using the internal decompression features of tar, both out of habit and to avoid unexpected results.

As such, I generally use command lines like: bunzip2 -c <tar.bz2 file> |tar xvf -

instead of relying on tar xvjf

I don't see it as wrong or bad to use tar's decompression features, it's more about my own preferences and experience. Being able to perform similar actions in multiple ways is one of the things I've always appreciated about the shell and the Unix/GNU userland.

Re:Use long flags when scripting (2013) by maple3142 on Friday September 18, 2020 @08:11PM (#24523228)
You can use atool (https://www.nongnu.org/atool/) too. It is just some perl scripts wrapper around some commom extraction tools.
Re:Use long flags when scripting (2013) by eMSF on Friday September 18, 2020 @08:06PM (#24523182)
I guess you only ever extract punctually named files. But it's still rather amusing that with the exception of 'case', the only places where $1 is properly quoted are the ones where it's not really necessary, and vice versa (but then again, it's not done for the parameter, but rather the single quotes).

Anyway, my advice to you and anyone else having trouble with tar is that "tar caf" and "tar xaf" are the only things most people need to remember about tar, with or without compression.

(In this case, most people means people who use tar, but so rarely that they have trouble remembering how to use it; they probably never use it for anything else other than (un)archiving. Also, xkcd isn't gospel.)

Re:Use long flags when scripting (2013) by stack_underflow on Friday September 18, 2020 @05:34PM (#24522104)
These two commands should fit most of your use cases:

  tar cf dir.tar dir          # mnemonic: 'create file' <tar-file-name> <dir-to-tar>
  tar xf dir.tar(.gz|bz2|...) # mnemonic: 'eXtract file' <tar-file-name>
On systems with "modern" versions of tar `-x` is capable of recognizing which compression format is used and doesn't require the explicit `-j/z` flags you usually see.
Re:Use long flags when scripting (2013) by corpMaverick on Friday September 18, 2020 @07:28PM (#24522874)
Exactly, these are the only ones I know and never get confused. Actually I use cvzf and xvzf.
Re:Use long flags when scripting (2013) by stjohnswarts on Saturday September 19, 2020 @12:06AM (#24524945)
you might want to at -p for preserving permissions in there are well, handy for archiving
Re:Use long flags when scripting (2013) by a1369209993 on Saturday September 19, 2020 @01:59AM (#24525494)
> To disarm the bomb, simply enter a valid tar command on your first try. No Googling. You have ten seconds.

  $ tar --help
Obviously. :)
Re:Use long flags when scripting (2013) by scbrg on Saturday September 19, 2020 @02:43AM (#24525664)

    $ tar --help
    tar: unknown option -- help
    usage: tar [-]{crtux}[-befhjklmopqvwzHJOPSXZ014578] [archive] [blocksize]
               [-C directory] [-T file] [-s replstr] [file ...]
    $
Re:Use long flags when scripting (2013) by a1369209993 on Saturday September 19, 2020 @03:17AM (#24525787)
Okay, so your tar is defective[0], and? I can do that too:

  $ list '#! /bin/sh' 'echo "tar: invalid command" >&2' 'exit 64' >/tmp/tar
  $ chmod a+x /tmp/tar
  $ PATH="/tmp:$PATH"
  $
  $ tar -cf a.tar a/
  tar: invalid command
  $
0: any program that doesn't support --help is defective, which was rather my point.
Re:Use long flags when scripting (2013) by scbrg on Saturday September 19, 2020 @03:56AM (#24525929)
> 0: any program that doesn't support --help is defective, which was rather my point.

Fair enough. My point was that there's a category of operating systems where long options (including --help) isn't really a thing. You may of course consider them defective, though I'm not sure everybody agrees.

Re:Use long flags when scripting (2013) by dev_tty01 on Sunday September 20, 2020 @09:54AM (#24534056)
$ tar -h

Even better. :)

Re:Use long flags when scripting (2013) by lhorie on Saturday September 19, 2020 @10:36AM (#24527692)
I dunno. I may know them but the next person may not. Where I work, there are plenty of people who primarily work w/ other langs and only dabble in bash once in a blue moon.

Case in point, when I was learning, I'd copy and paste snippets I found online without understanding what some flags did. At first I didn't even know how to look up docs, and googling for the meaning of shorthand isn't always fruitful, especially given the "don't know how to find docs" limitation.

I've even ran into cases where the next person is myself. For example at one point, I "knew" docker flags while it was fresh in my mind, but then forgot what they meant a few months later...

Re:Use long flags when scripting (2013) by redisman on Friday September 18, 2020 @03:25PM (#24520894)
I think you're assuming a level of Unix knowledge that less and less new people in the field are going to have.
Re:Use long flags when scripting (2013) by nostoc on Friday September 18, 2020 @11:59PM (#24524898)
Someone who's tasked with maintaining shell scripts better be familiar with the shell.
Re:Use long flags when scripting (2013) by harisund on Saturday September 19, 2020 @07:33AM (#24526709)
that's kinda his point.

Kids today no longer know the shell. They think just writing some yaml files in ansible is sufficient. Giving them a shell script won't help at all.

Re:Use long flags when scripting (2013) by nobody9999 on Saturday September 19, 2020 @09:28AM (#24527275)
>Kids today no longer know the shell.

Sounds like Kochan and Wood[0] need some love (and royalties).

Or is learning stuff deprecated these days?

[0] https://www.amazon.com/Unix-Shell-Programming-Stephen-Kochan...

Re:Use long flags when scripting (2013) by matheusmoreira on Friday September 18, 2020 @07:26PM (#24522862)
> If you're working on shell scripts, you probably know certain short flags well enough that long flags just add clutter and don't improve readability.

What about other people who might read the script?

Re:Use long flags when scripting (2013) by webreac on Saturday September 19, 2020 @06:15AM (#24526391)
I have more difficulties to read long flags. The people who want to improve by reading my scripts will have to search for the short flags because nobody use long flags from command line. IMHO the benefits of long flags vs short ones are not obvious.
Re:Use long flags when scripting (2013) by lcuff on Friday September 18, 2020 @05:52PM (#24522255)
I argue that 'very commonly used' is subjective, and someone new won't know all the ones you or I consider common. One of my goals in writing software is to make my code understandable to complete newcomers. I can't always achieve it. Sometimes other design goals take priority. But from my perspective this one is a no-brainer. I just don't see the down side. If it's too time consuming to type, use them for typing practice and get faster :-)
Re:Use long flags when scripting (2013) by anjanb on Saturday September 19, 2020 @09:02AM (#24527144)
I would agree. Especially when you have something like https://explainshell.com/ to help you understand a command and its flags. It would be nice to have editor/IDE extensions which can do equivalent of explainshell.com's functionality.
Re:Use long flags when scripting (2013) by nooyurrsdey on Friday September 18, 2020 @05:47PM (#24522215)
While i agree these are "common" you now have to define what common flags are. It's easier for an organization to just have a blanket rule to use long form expressions

Also is typing that much of a chore?

Re:Use long flags when scripting (2013) by rgoulter on Saturday September 19, 2020 @12:00PM (#24528347)
Yes. Suggestions are good. Following suggestions with purpose is better. Or, rather, blindly following suggestions without understanding the benefits (and costs to) the suggestions doesn't seem ideal to me. -- It respects the great answer of "it depends".

Gonna admit that I wouldn't be able to tell what grep -i, sed -e do. (I would've used `sed -e` before, but not enough to remember that). Still, some things are clear from context.

Re:Use long flags when scripting (2013) by michaelcampbell on Saturday September 19, 2020 @08:12AM (#24526896)
Indeed. Almost all arguments are "readability" are only relevant to a given reader. Everything is hard to read until you learn to read it.
Re:Use long flags when scripting (2013) by leoh on Saturday September 19, 2020 @12:18AM (#24525009)
I disagree. BSD and GNU implementations differ. Because of this, it's easier to discern intent of long flags.
Re:Use long flags when scripting (2013) by scbrg on Saturday September 19, 2020 @02:46AM (#24525676)
I assume the intent to discern, then, is that the script isn't supposed to run on BSD :-)
Re:Use long flags when scripting (2013) by 0xdeadb00f on Saturday September 19, 2020 @01:30AM (#24525392)
Also, some BSD equivalents of GNU commands don't even have long flags.
Re:Use long flags when scripting (2013) by leoh on Sunday September 20, 2020 @04:37PM (#24537197)
That's not the point. The point is that you can discern intent if you are writing against the GNU implemention so one can trivially reimplement against BSD.
Re:Use long flags when scripting (2013) by OskarS on Friday September 18, 2020 @02:48PM (#24520504)
How often do you use gzip verbose? I don't think I've ever used it. What's it good for?
Re:Use long flags when scripting (2013) by zbuf on Friday September 18, 2020 @02:53PM (#24520560)
Personally a fan of '--verbose' to be honest. It's clear. "grep -v" anyone?
Re:Use long flags when scripting (2013) by frenchy on Friday September 18, 2020 @03:08PM (#24520730)
Particularly in this case, because `-v` sometimes means "print out the version number".
Re:Use long flags when scripting (2013) by jfrunyon on Friday September 18, 2020 @03:11PM (#24520758)
That's why they mentioned `grep -v`. Go look it up. It doesn't mean verbose OR version.

Doubt you'd be printing out a version number in a shell script though.

Re:Use long flags when scripting (2013) by cogburnd02 on Friday September 18, 2020 @03:52PM (#24521199)
You may want to compare a version number of a command to make sure it's bigger than (or equal to) the minimum version required by your script, though.
Re:Use long flags when scripting (2013) by codazoda on Friday September 18, 2020 @04:42PM (#24521694)
>-v, --invert-match

> Selected lines are those not matching any of the specified patterns.

For the lazy.

Edit: I don't know hackernews formatting and I'm among the lazy, so... Marked as "won't fix".

Re:Use long flags when scripting (2013) by mattkrause on Saturday September 19, 2020 @11:22AM (#24528012)
Of all the options, it is so fitting and proper to use the long form for —-verbose.
Re:Use long flags when scripting (2013) by adrianmonk on Friday September 18, 2020 @03:17PM (#24520817)
It shows you the percentage reduction in size.

It's rare that I'd use it in a script. Perhaps I'd use it for a script whose main purpose is creating an archive to be widely distributed. Then the info might be of interest to the script's user.

But your comment brings up a good point about the difficulty of deciding what short flags truly are widely known. I assumed anyone who uses gzip regularly would know "-v", but maybe that isn't true.

Re:Use long flags when scripting (2013) by ryanianian on Friday September 18, 2020 @02:54PM (#24520568)
It's useful when debugging your artifacts. It's a nice shortcut for adding a `find` after the `tar` invocation. Outside of debugging I've never seen the gzip/tar verbose output as anything other than clutter.
Re:Use long flags when scripting (2013) by jandrese on Friday September 18, 2020 @02:52PM (#24520552)
Pretty much just to make sure you're not wasting your time with the gzip.

But I also don't use gzip much these days. pbzip2 is a drop in replacement that is faster and compresses better.