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


Groups > gnu.bash.bug > #11382 > unrolled thread

Re: Parameter Expansion: Case Modification: ${var~} not documented

Started byChet Ramey <chet.ramey@case.edu>
First post2015-08-18 16:50 -0400
Last post2015-08-18 16:50 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Parameter Expansion: Case Modification: ${var~} not documented Chet Ramey <chet.ramey@case.edu> - 2015-08-18 16:50 -0400

#11382 — Re: Parameter Expansion: Case Modification: ${var~} not documented

FromChet Ramey <chet.ramey@case.edu>
Date2015-08-18 16:50 -0400
SubjectRe: Parameter Expansion: Case Modification: ${var~} not documented
Message-ID<mailman.8571.1439931052.904.bug-bash@gnu.org>
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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web