Ralph Corderoy <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>, (Helmut Waitzmann) [EMAIL PROTECTED] _______________________________________________ Bug-tar mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-tar
