Re: [OT] shell quoting [SOLVED]

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

 



 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

diff won't help much as I need an explicit list
of new/added files in a tree of ~10K files.
Besides -x only works on basenames.

 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[@]}"

This one's interesting.
Thanks Luciano!

DIR=.
OPT=('!' '-path' $DIR'/bb*')
find $DIR "${OPT[@]}"

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux