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


Groups > gnu.bash.bug > #11369

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

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!usenet.stanford.edu!not-for-mail
From Dan Douglas <ormaaj@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Parameter Expansion: Case Modification: ${var~} not documented
Date Tue, 18 Aug 2015 09:22:07 -0500
Lines 25
Approved bug-bash@gnu.org
Message-ID <mailman.8529.1439907735.904.bug-bash@gnu.org> (permalink)
References <CAO9HFd=EKGJ3KpuJtOcfWTn2F88ZFs=RUjjA9YF_rwJE9HY=gw@mail.gmail.com> <2003282.EDlDJ6aKWn@smorgbox>
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 1439907736 11972 208.118.235.17 (18 Aug 2015 14:22:16 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Isaac Good <isaacgood@gmail.com>
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding:content-type; bh=mBMTwxhbTHS4YsGMOFtfN5tvYmsKBJb4wugvDKqniR8=; b=aEid197Z4/fkWyHR0bjPsKNX+hqrNVFrKhqt4ICye7LWZgRN3AYoWc+G21eoPvGvjV Ze3wDSsuHulesuLNFfymebnILyGQB84dFnfxvwR0XlTeUbJdy7AyELcJxt4FWsPzlUdN 0jSrCXysP8RdjC0yv5e6VasOsubz4ORaeQZN8kaMTFohNXvW/cW3GSrHLZZTVBUXmjnL uKBgiAy5Al6KAu76srOWd0FO4JsLCwyOPTcFsEmSd/uPmZ3R72dmzN2GZaBdRtQ6kmMR OAkcc7wqvfZeZBLUC0X8xLM5/y2NhzurJkUX0QKiHONVK0GsbwzwssQ2IKbNkQ24XyZR vwUQ==
X-Received by 10.50.93.102 with SMTP id ct6mr7072230igb.75.1439907728997; Tue, 18 Aug 2015 07:22:08 -0700 (PDT)
User-Agent KMail/5.0.41 alpha1 (Linux/4.2.0-rc7; KDE/5.14.0; x86_64; ; )
In-Reply-To <2003282.EDlDJ6aKWn@smorgbox>
X-detected-operating-system by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value).
X-Received-From 2607:f8b0:4001:c05::22b
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11369

Show key headers only | View raw


On Tuesday, August 18, 2015 08:50:51 AM Dan Douglas wrote:
> I'm pretty sure that's intentional. The corresponding `declare -c` has never 
> been documented either.
> 

Hrm, it doesn't "correspond" actually. declare -c just capitalizes the first 
letter of the string.

Another thing about the ${var~} expansions is I wonder why it isn't just built 
in to the substitution expansion. The `~` is obviously inspired by the vim 
movement to toggle caps. Given `foobarbaz`, vim can also do `:s/foo\zs\(bar\)
\zebaz/\U\1/` and yield `fooBARbaz`. This is much more powerful, though it 
requires bash to start supporting backrefs in substitutions.

There's also this ksh feature I've never found a use for:

$ ksh -c 'x=foobarbaz; typeset -M toupper x; echo "$x"'
FOOBARBAZ

I don't know, the only purpose is to replace `typeset -l/-u` and allow for 
other towctrans operations.

-- 
Dan Douglas

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


Thread

Re: Parameter Expansion: Case Modification: ${var~} not documented Dan Douglas <ormaaj@gmail.com> - 2015-08-18 09:22 -0500

csiph-web