Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14459

Re: Tilde expansion in assignment-like context

From Ilkka Virta <itvirta@iki.fi>
Newsgroups gnu.bash.bug
Subject Re: Tilde expansion in assignment-like context
Date 2018-08-07 08:39 +0300
Message-ID <mailman.4786.1533620380.1292.bug-bash@gnu.org> (permalink)
References <349F67EA-6EA7-4C8E-8E3A-AC36A82EBFBD@gmail.com> <3f04a0db-0583-d5d9-1faf-75deb76c1219@case.edu>

Show all headers | View raw


On 6.8. 22:45, Chet Ramey wrote:
> Yes. Bash has done this since its earliest days. A word that looks like an
> assignment statement has tilde expansion performed after unquoted =~ and :~
> no matter where it appears on the command line. 

Given that options starting with a double-dashes (--something=/some/dir) 
are rather common, would it make sense to extend tilde expansion to 
apply in that case too?

Of course, getopt_long() supports giving the option argument in a 
separate command-line argument, so you can work around it with that.


Also, does the documentation actually say tilde expansion applies in 
anything that looks like an assignment? I can only see "If a word begins 
with an unquoted tilde character..." and "Each variable assignment is 
checked for unquoted tilde-prefixes...", but from the shell language 
point of view, the one in 'make DESTDIR=~stager/bash-install' isn't an 
assignment, just a regular command line argument.

The paragraph about assignments could be expanded to say "This applies 
also to regular command-line arguments that look like assignments." or 
something like that.


-- 
Ilkka Virta / itvirta@iki.fi

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Tilde expansion in assignment-like context Ilkka Virta <itvirta@iki.fi> - 2018-08-07 08:39 +0300

csiph-web