bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] tar (GNU tar) 1.15.1 bugreport: tar -C <dir> doesn't suppo


From: Helmut Waitzmann
Subject: Re: [Bug-tar] tar (GNU tar) 1.15.1 bugreport: tar -C <dir> doesn't support fileglobbing
Date: Fri, 07 Jul 2006 20:48:47 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Ralph Corderoy <address@hidden> writes:

>Another alternative is
>
>    cd /not/backup
>    tar -C /backup -cf /backup/tmp.tar $(cd /backup && ls tmp-*.txt)
>
>The shell first runs 'cd /backup && ls tmp-*.txt' and replaces the
>$(...) with the command's output.  It then runs tar.

No.  It's not an alternative:  If the filenames which are reported by
"ls" contain white space, the shell will split those filenames into
words.  For an example try the following commands:

touch -- /backup/'tmp-filenames with white space break this command.txt'
cd /not/backup
tar -C /backup -cf /backup/tmp.tar $(cd /backup && ls tmp-*.txt)

So dont't ever do "$(ls ...)".  It may fail.
-- 
Wenn Sie mir E-Mail schreiben, stellen  | When writing me e-mail, please
Sie bitte vor meine E-Mail-Adresse      | precede my e-mail address with
meinen Vor- und Nachnamen, etwa so:     | my full name, like
Helmut Waitzmann <address@hidden>, (Helmut Waitzmann) address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]