From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: bash conversion trouble.
Date: Fri, 24 Feb 2017 20:41:53 -0800 [thread overview]
Message-ID: <170224204153.ZM19840@torch.brasslantern.com> (raw)
In-Reply-To: <004ec4f2-3b3a-8907-86a6-4326399783aa@eastlink.ca>
On Feb 24, 5:35pm, Ray Andrews wrote:
} Subject: bash conversion trouble.
}
} Gentlemen:
}
}
} I'm trying to convert a long script from bash, which I know not at all,
} to zsh, which I know hardly better:
}
} bash likes thisbut zsh throws a syntax error:
}
} case "${USE_OVERLAYFS,,}" in
${parameter^pattern}
${parameter^^pattern}
${parameter,pattern}
${parameter,,pattern}
Case modification. This expansion modifies the case
of alphabetic characters in parameter. The pattern
is expanded to produce a pattern just as in pathname
expansion. The ^ operator converts lowercase letters
matching pattern to uppercase; the , operator converts
matching uppercase letters to lowercase. The ^^ and ,,
expansions convert each matched character in the expanded
value; the ^ and , expansions match and convert only
the first character in the expanded value. If pattern
is omitted, it is treated like a ?, which matches every
character. If parameter is @ or *, the case mod ification
operation is applied to each positional parameter in turn,
and the expansion is the resultant list. If parameter
is an array variable sub scripted with @ or *, the case
modification operation is applied to each member of the
array in turn, and the expansion is the resultant list.
So bash ${name,,} is zsh ${(L)name} ... and there isn't a simple zsh
equivalent for what happens if there is a pattern following the ,,
It'd also be kind of ugly to add ${name^pat} to zsh at this point, as
we've already got ${name:^var} and ${name:^^var} which mean something
radically different. (Not implementation-ugly, but semantics-ugly.)
next prev parent reply other threads:[~2017-02-25 4:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-25 1:35 Ray Andrews
2017-02-25 4:41 ` Bart Schaefer [this message]
2017-02-25 15:13 ` Ray Andrews
2017-02-25 15:26 ` Peter Stephenson
2017-02-25 15:55 ` Bart Schaefer
2017-02-25 16:24 ` Ray Andrews
2017-02-25 17:02 ` Bart Schaefer
2017-02-25 19:13 ` Ray Andrews
2017-02-25 20:09 ` Bart Schaefer
2017-02-26 5:05 ` Ray Andrews
2017-02-26 17:19 ` Bart Schaefer
2017-02-26 18:03 ` Ray Andrews
2017-02-26 21:10 ` Shell history (Re: bash conversion trouble.) Bart Schaefer
2017-02-26 23:23 ` Ray Andrews
2017-02-28 15:56 ` bash conversion trouble Stephane Chazelas
2017-02-28 19:27 ` Ray Andrews
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=170224204153.ZM19840@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).