[OT] shell quoting
Luciano Rocha
strange at nsk.no-ip.org
Thu Sep 20 08:39:00 UTC 2007
On Thu, Sep 20, 2007 at 12:28:48AM +0400, Alexander Kirillov wrote:
> Hi all!
>
> I need to compare two different versions of a source tree
> excluding certain directories and print out some statistics
> on the files which have been changed, removed or added.
diff -urN -x 'bb*' old new | diffstat
<snip>
> and I want to exclude all paths starting with ./bb
> This one is easy:
>
> find . ! -path './bb*'
>
> Now I want to make it into a generic script:
>
> DIR=.
> OPT='! -path $DIR/bb*'
> find $DIR $OPT
>
> $DIR and * within OPT are essential
> and no matter what I've tried I can't get the parameter expansion right.
Use arrays:
declare -a options
options=( '!' '-path' './bb*')
options+=( '-type' 'f')
...
And then:
find $DIR "${options[@]}"
--
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070920/48348e7c/attachment-0001.sig>
More information about the fedora-list
mailing list