Web lists-archives.com

Re: Running of rrequested tests - [was Re: Backup problem using "cp"]




On Wed 09 May 2018 at 16:32:03 (-0400), Greg Wooledge wrote:
> On Wed, May 09, 2018 at 03:20:06PM -0500, David Wright wrote:
> > remove-empties () 
> > { 
> >     [ -z "$1" ] && printf '%s\n' "Usage:	$FUNCNAME directories ...
> > 	removes any empty directories under the directories given after prompting." 1>&2 && return 1;
> >     local IFS="
> > ";
> >     find $* -depth -xdev -type d -empty -ok rmdir {} \;
> > }
> 
> $* should be "$@" with the quotes.
> 
> find "$@" -depth -xdev -type d -empty -ok rmdir {} \;

Reviewing my .bashrc, I can see that I had converted 74 occurrences
of $* to "$@" long ago, but 5 had escaped me; I don't know why.

> > (To Greg: is there a better IFS to use?)
> 
> IFS is irrelevant when you quote properly.  You can simply remove that
> assignment command.

OTOH I hadn't bothered to remove their accompanying IFS assignment in
about 50 cases, so I've had a useful tidy up. Probably originated in
some script I copied in the late 20th century. Thanks.

Cheers,
David.