Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: aliases in zsh -c and eval
- X-seq: zsh-workers 33811
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: aliases in zsh -c and eval
- Date: Thu, 27 Nov 2014 21:25:07 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=ak2MdOnY0iBs7p9pqaBGzeNn4Aqh4ChYKIV8/2yNHlU=; b=pLXabK9llUwKzIIEkjblQbgch7j2SyXApAeMz/Q3kHOSv1A5n9ZVbcKf9WRnY5LQhp 4QjO6MsIAIVcl7UMtt5jU3c+zVgu5XIwjah2kHuWFwVRJcUaIzIrTuOk4hsLvl+bHcpn OG8pOF6rbiDFa0bB1Vx+VLH9Dyj8TqErBkahROPrxuuqfZux1GI65sS0Uy56glTDXmzu awdwOfaNQ/SvUQB9tyt09MQHe4uMyYDE8GpDYQs8KJUbhtBV0xbkgCsVzPjJNK/Rj/DT Tw8F9xAMx5+TzUvFY83tOHG1JZOPRE9eQ8B/jKOQ8Grjajok1hPpqGGEX6FNnWY6ouCi 5X4Q==
- In-reply-to: <20141127212221.GC5951@chaz.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20141127212221.GC5951@chaz.gmail.com>
2014-11-27 21:22:22 +0000, Stephane Chazelas:
> Hiya,
>
> it looks like aliases defined in `zsh -c` are not expanded in
> there:
>
> $ zsh -c 'alias foo=echo
> foo bar'
> zsh:2: command not found: foo
>
> Those defined for instance in ~/.zshenv are expanded. And:
>
> $ zsh -c 'alias foo=echo
> eval foo bar'
> bar
>
> It looks like zsh is the only one out here. (with bash you need
> bash -O expand_aliases).
>
> Same with eval:
>
> $ (eval 'alias foo=echo
> subsh quote> foo bar')
> zsh: command not found: foo
> $ (eval 'alias foo=echo
> eval foo bar')
> bar
>
> This time, ksh93 does behave like zsh.
[...]
For completeness:
$ cat > a
alias foo=echo
foo bar
$ zsh a
bar
$ zsh -c '. ./a'
bar
$ zsh -c 'eval "$(cat ./a)"'
(eval):2: command not found: foo
$ ksh a
bar
$ ksh -c '. ./a'
ksh: .[2]: foo: not found [No such file or directory]
ksh worse this time.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author