bug-bash
[Top][All Lists]
Advanced

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

Re: Tilde expansion in assignment-like context


From: Ilkka Virta
Subject: Re: Tilde expansion in assignment-like context
Date: Tue, 7 Aug 2018 08:39:25 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

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



reply via email to

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