[ale] tar weirdness
Joe
jknapka at earthlink.net
Sat Jan 25 02:12:57 EST 2003
"Michael D. Hirsch" <mhirsch at nubridges.com> writes:
> On Friday 24 January 2003 09:58 am, James P. Kinney III wrote:
> > Tar is not working the way I think it is suppose to. I want to tarball a
> > directory EXCEPT for files ending in .gdbm
> >
> > tar cvzf tarball.tar.gz --exclude dir/*.gdbm dir
> >
> > All it tars ARE the gdbm files. Does tar not support globing?
>
> The man page and the info page on tar disagree on the usage of this flag.
> The man page says:
> --exclude FILE
> exclude file FILE
> But the info page says:
> `--exclude=PATTERN'
> Causes `tar' to ignore files that match the PATTERN.
It is my belief (unconfirmed by any clever ploy such as, oh, reading
the docs) that the way "getopt" works is that double-dash options
*always* have their argument "attached" to them with an = sign.
So in Jim's original command,
tar cvf file.tar --exclude "*foo*" dir
tar says to itself, "OK, he's asking me to exclude *nothing*, and
tar up every *foo* and dir." But if instead you say:
tar cvf file.tar "--exclude=*foo*" dir
it should work. (Note that you gotta have the "" around the
pattern to avoid the shell globbing it before tar gets
a chance to.)
And a brief experiment confirms that, in fact, it works :-)
Cheers,
-- Joe
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list