[Top][All Lists]

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

Re: RFC: turn off word splitting for vars but keep for read

From: Bob Proulx
Subject: Re: RFC: turn off word splitting for vars but keep for read
Date: Mon, 25 Nov 2013 13:46:13 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Greg Wooledge wrote:
> Bob Proulx wrote:
> > Aleksey Midenkov wrote:
> > > rmcmd="$rmprog -f"
> > > 
> > > Because it will fail for files with spaces.
> > 
> > I am sure we disagree but I don't consider making rm program names
> > have spaces to be reasonable.  :-/
> > 
> > What would it be?  "remove command"?  I definitely would not consider
> > an executable named with spaces that way to be reasonable.
> How about /mnt/c/Program Files/something/DEL.EXE?  The directory might
> contain spaces even if the command name itself does not.

That would be using a full hard coded path.  I think using full hard
coded paths is bad for yet different reasons.

Here in this context it might be argued that hard coding the path is
part of a specific host's customization.  But IMNHO it is always
better to set PATH in that case.  Because it is never just one
command.  It will almost always be several commands in an open ended
list of possibilities.  In which case you will need PATH set
appropriately.  Having a PATH with spaces in it won't cause a problem
in this context.  But in any case such host customizations are better
to occur in a sourced configuration file and not in a production
script itself.

As a matter of style I very rarly would set options with the program
name in a program name variable.  (RSYNC_RSH comes to mind.)  I would
more typically set a companion $program_args variable instead.  But
then expect word splitting to occur in that args variable.  So it is
still the same issue just moved to a slightly different location.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]