[Top][All Lists]
[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: |
Tue, 11 Jul 2006 23:10:31 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Ralph Corderoy <address@hidden> writes:
>Point taken, but it was meant to illustrative of basic shell issues on a
>system controlled by the user rather than a robust, catch anything
>thrown at us, backup strategy. Filenames with spaces break most simple
>/bin/sh scripting techniques anyway...
Yes, that's right. On the other hand: I don't think that a user, which
apparently doesn't know about shell's globbing mechanism, will be
able to ameliorate a receipe which doesn't do its job.
> x=
> for f; do
> test -x $f && x="$x $f"
> done
>
>You have to muck around with later shells things like bash's arrays
>instead.
Yes. Or use bash's printf format "%q" (and always use quotation marks
when expanding parameters):
x=
for f
do
test -x "$f" && x="$(printf ' %q' "$x" "$f")"
done
Then split x to the positional parameters before using them:
eval set x "$f" && shift && tar -C /backup -cf /backup/tmp.tar ${1+"$@"}
Cheers,
Helmut
--
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