[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: |
Ralph Corderoy |
Subject: |
Re: [Bug-tar] tar (GNU tar) 1.15.1 bugreport: tar -C <dir> doesn't support fileglobbing |
Date: |
Sat, 08 Jul 2006 10:14:17 +0100 |
Hi Helmut,
> 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.
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...
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.
Cheers,
Ralph.