zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: why is eval needed?
Date: Sun, 20 Nov 2022 14:47:48 -0800	[thread overview]
Message-ID: <c254d142-b32a-ab58-2293-fbae54463f24@eastlink.ca> (raw)
In-Reply-To: <20221120201659.na4ypuivspeoowhu@chazelas.org>


On 2022-11-20 12:16, Stephane Chazelas wrote:
>
>> But that's the thing, I'd naively thought the variable could be inserted in
>> the command string and be 'just' a string of characters, but zsh imposes
>> that 'tree' must see '-L 2' as a single entity, yes?
> No, you have it completely backwards.
But everything so far seems to tell me that I'm right.  When '-L 2' is 
presented as two arguments instead of one, everything is fine. Are we 
miscommunicating?
> And I think at the heart
> of your misunderstanding there is the misconception that you
> pass a "command string" to an executable.
>
> You do not, you pass a list of arguments.

> I know, but at least on the command line one can think of it as a string.  I understand that it it will be parsed as 'words' (including spaces if quoted).
>
> Why store those two arguments as a string with a space in between them
> and then ask the shell to split it, that makes no sense.
I know that now.  But as we discussed, the normal thing is for a switch 
to present as a single argument so that's what I did.  I quite 
understand the mistake NOW.
> (¹ a complication and a spanner in the works is that environment
> variables (those VAR=value strings passed in envp[] above) are
> string/scalar only; in csh and in the Bourne shell, shell variables and
> env variables were more separated than they are in modern shells).
Awesome that you can keep all this stuff in memory and not get your 
wires crossed.
>
> What about:
>
> files=(
>    'my file.txt'
>    'my other file.txt'
> )
> rm -- $files
>
> Should they be split too?
No, I understand that well.  I think this is a closed issue, I think I'm 
quite content.
> Ah!  So my little issue is a zsh exclusive?
> No, again, any recent shell
Ok, not 'exclusive' but it's been a point of difference between at least 
zsh and bash.
> No, it's not tree being difficult. In any command doing 

Bbbbut we've agreed that tree is being difficult!  You've explained it 
in great detail.

> apt-file is your friend.
So it is!
> Will tell you what package the tree command comes from.
>
> apt showsrc that-package

It's just not something I need to worry about.  To me it's all 'Linux'.  
Maybe one day I'll download some sources (if in C) and start tinkering.  
For now it just doesn't matter.   The thing is to get a bit more 
competent with zsh.





      parent reply	other threads:[~2022-11-20 22:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 14:34 Ray Andrews
2022-11-19 14:43 ` Roman Perepelitsa
2022-11-19 17:02   ` Ray Andrews
2022-11-19 17:10     ` Roman Perepelitsa
2022-11-19 18:02     ` Clinton Bunch
2022-11-19 18:18       ` Roman Perepelitsa
2022-11-19 16:48 ` Stephane Chazelas
2022-11-19 19:12   ` Ray Andrews
2022-11-19 19:50     ` Lawrence Velázquez
2022-11-19 22:21       ` Ray Andrews
2022-11-20  8:55         ` Stephane Chazelas
2022-11-20 13:47           ` Ray Andrews
2022-11-20 15:08             ` Stephane Chazelas
2022-11-20 16:27               ` Ray Andrews
2022-11-20 20:16                 ` Stephane Chazelas
2022-11-20 22:31                   ` Bart Schaefer
2022-11-21  2:13                     ` Ray Andrews
2022-11-20 22:47                   ` Ray Andrews [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c254d142-b32a-ab58-2293-fbae54463f24@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).