Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: why is eval needed?
- X-seq: zsh-users 28412
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: why is eval needed?
- Date: Sat, 19 Nov 2022 09:02:38 -0800
- Archived-at: <https://zsh.org/users/28412>
- In-reply-to: <CAN=4vMpXpq=Bk0KeZwE3Uz=QVZ0MBeLQ6Gw7_a51BHSyf+Haag@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <d0ef2035-e8e9-00c5-7f53-b16609d96262@eastlink.ca> <CAN=4vMpXpq=Bk0KeZwE3Uz=QVZ0MBeLQ6Gw7_a51BHSyf+Haag@mail.gmail.com>
On 2022-11-19 06:43, Roman Perepelitsa wrote:
With the default options this this the same as this:
tree '-L 2'
Is it clear why it doesn't work?
Actually yes ... but that was only my last effort. With double quotes
the error is:
> -L 2 [error opening dir]
... and with no quotes it's:
> test:local:5: not valid in this context: -L
... to correct myself, it's really the double quoted offering that I'd
expect to work. I'm pretty sure this is an invisible grouping of
arguments but I don't know what to do about it other than 'eval'. I'm
thinking that when tree sees: " -L 2 " it's seeing that not as a switch
followed by a number, but as a single syntactic element which it's
trying to interpret as a directory name. Which sorta is
semi-understandable since the quotes make " -L 2 " into 'one thing'
whereas tree want's it to be 'two things'. How to drop that variable in
there so that tree is happy with it? Is this perhaps a bit of
crabbiness on the part of tree? Should " -L 2 " be an array?? Sheesh,
that might keep tree happy. And ...
local level=( -L 2 )
tree $level
...
Success! Ha! You give me enough feedback that I can talk myself out of
the problem :-)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author