Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: Parameter Expansion: Case Modification: ${var~} not documented Date: Tue, 18 Aug 2015 16:50:38 -0400 Lines: 40 Approved: bug-bash@gnu.org Message-ID: References: <55D34377.9010305@case.edu> <3059638.V9nJ3FgFh1@smorgbox> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1439931052 25460 208.118.235.17 (18 Aug 2015 20:50:52 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Isaac Good , chet.ramey@case.edu To: Dan Douglas , bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: <3059638.V9nJ3FgFh1@smorgbox> X-Junkmail-Status: score=10/50, host=mpv5.cwru.edu X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 129.22.105.36 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11382 On 8/18/15 1:43 PM, Dan Douglas wrote: > On Tuesday, August 18, 2015 9:54:55 AM CDT Isaac Good wrote: >> Would you mind sharing the rational behind having it undocumented? > > Since I like guessing: the syntax for parameter expansion operators is > currently non-extensible, so the namespace of terse operators is in limited > supply. New syntax should be extensible to suit future needs while keeping the > language minimal. This is new syntax that adds one function that will be > rarely used. I can think of better ways to use that operator. This is true, and I would prefer to not set the ~ `operator' in stone until I'm more satisfied with how it works. Bash-4.4 has the ${param@operator} family of expansions (inspired by a similar feature in mksh) as the extensible syntax you're asking for. > The operators in use currently are already a disaster. We *really* could use a > solution for the circumfix operators `!var[@]` and `!var[*]` that collide with > the prefix `!` operator, and for reasons unknown don't interoperate with any > of the other expansions such as array slicing / subscripting. I wouldn't want > to add new (pointless) syntax before the fundamental problems are addressed. I assume you mean the difference betweeen ${!param[@]/followed/bysomething} and ${!param[@]}. The latter I picked up from ksh93 as is. The former is the generalization of indirect evaluation I sort of picked up from ksh93, because I didn't think you needed namerefs to have indirect evaluation. The first examples doesn't work as well as I hoped it would because I chose to use the `parameter' as used in other expansions (param[@]) as the unit of indirection instead of just the name (param). Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/