Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] quoting within bracket patterns has no effect
- X-seq: zsh-workers 37736
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [BUG] quoting within bracket patterns has no effect
- Date: Fri, 22 Jan 2016 17:49:49 -0800
- 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:content-type; bh=xUNmEJhWrQDlUt+0DVD9pzg/nDpqD3IVELumTWmZuR0=; b=D6qqcjnqzanZ+7by6LpuMQ/pumL5PAKHpfmDHEqXRYVBEGH/R9/jq+1Qm0UhSE0EPS MwacZQ6bAI+De18R+ORKAFz3jW8LdLCWUlKM3DNYiM2AkygZnR8IAlWEbBV2TKHaQjXR NweJ9VL2M6St8yQA1GWAp77arRSei1QP6lH1e3pZhFlNweit5d8zAh/9KlWt9V+u3V+w pqq+2p67ioGMTbXHF+CbjQqY5LrlgRCXJTS60+SPfn7riNgyZtnkCuBoLZmhdRgElXPR Vek7uLwyHtFi8luF+JKyUIFeEMYgPAYYWecI/0uHz8vUi95CqoxM7Og62+n4W5aP2uj2 JVbA==
- In-reply-to: <56A2C6A8.4090108@inlv.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <569C68AB.2010806@inlv.org> <20160118172434.2fb7d5b9@pwslap01u.europe.root.pri> <56A2C6A8.4090108@inlv.org>
On Jan 23, 12:17am, Martijn Dekker wrote:
}
} However, for variables there is now a new problem, the opposite of the
} old one: unlike in every other shell, a range is not recognised even if
} the variable is *not* quoted. So quoting a variable still has no effect,
} it's just that range parsing from variables was disabled altogether. The
} following code:
}
} myrange='a-z'
} somevar='c'
} case $somevar in
} ( *[$myrange]* ) echo "$somevar is part of $myrange" ;;
} esac
}
} outputs "c is part of a-z" on every shell except current zsh.
This is related to long-standing behavior for zsh in native mode.
In as-close-as-zsh-has-to-POSIX mode:
schaefer[655] ARGV0=sh Src/zsh
$ myrange='a-z'
$ somevar='c'
$ case $somevar in
> ( *[$myrange]* ) echo "$somevar is part of $myrange" ;;
> esac
c is part of a-z
$
In native mode you need to use $~param to activate pattern characters
in the expanded value:
schaefer[656] Src/zsh -f
torch% myrange='a-z'
torch% somevar='c'
torch% case $somevar in
case> ( *[$~myrange]* ) echo "$somevar is part of $myrange" ;;
case> esac
c is part of a-z
torch%
It's true that needing this inside a character class now differs from
previous versions of zsh for native mode. I'm not sure it's possible
to have it both ways.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author