Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Disabling an option for a single statement
- X-seq: zsh-users 27988
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Disabling an option for a single statement
- Date: Mon, 22 Aug 2022 21:18:30 -0700
- Archived-at: <https://zsh.org/users/27988>
- In-reply-to: <CAMP9c5=rjSbDNs1QdDPY-s8Ki0iMM_0h7T6CP30_+wuB4FcmAw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5=rjSbDNs1QdDPY-s8Ki0iMM_0h7T6CP30_+wuB4FcmAw@mail.gmail.com>
On Mon, Aug 22, 2022 at 10:46 AM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>
> It's not uncommon that I want to disable a specific option (in my case, cdablevars) for a single statement.
There's not really a better way in general. There are of course the
noglob and nocorrect "precommand modifiers" which have this effect for
the GLOB and CORRECT options, but it's not generalized.
You can sort of make it work with something like
alias nocdv='() { setopt localoptions nocdablevars; "$@" } '
but that doesn't affect things that happen during argument
interpretation, such as potentially ${(D)var}, so there are several
options for which using an alias is not very helpful.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author