Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bash conversion trouble.
- X-seq: zsh-users 22488
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: bash conversion trouble.
- Date: Fri, 24 Feb 2017 20:41:53 -0800
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=brasslantern-com.20150623.gappssmtp.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=DvU2XJ+gOMWWOF1EHyrYaELollFmYbpn7R/9fZiRF1o=; b=0M50F5HN1GWj8msXkdUCzXZjI2WMtTczy35qGIu2UhDRFZPMhXL8CFgk0ESdm84hEy yh+GiRI6KgfS+c54XfNCsrwLkaPmLQCPeQfmAoDiJuCP+scPmMR/ZsVeDv0qx7qqpR8h aed6BmATfpkYjZCeiz3j043+cbWj9+xyCaSC7/L25izFvFBGL1TJQQIgqDlerc0RcyHF bPFmUo/DfBlG4itn9LiQH+PmHLXh2B3GuSTjP/rrXiWAObWoRUUlZamwBF4rzTFLOfgA vLHMGqFi8U/5S7hMc9Ee4fHsAyeItl9WTAjPYGzB4ftSbUBDd808hLHwr7rwvXvKRFNe QOlA==
- In-reply-to: <004ec4f2-3b3a-8907-86a6-4326399783aa@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <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.)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author