zsh-users
 help / color / mirror / code / Atom feed
* why is eval needed?
@ 2022-11-19 14:34 Ray Andrews
  2022-11-19 14:43 ` Roman Perepelitsa
  2022-11-19 16:48 ` Stephane Chazelas
  0 siblings, 2 replies; 18+ messages in thread
From: Ray Andrews @ 2022-11-19 14:34 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 891 bytes --]

  In a script:

    local level='-L 2'
    tree $level
    #eval tree $level

run it:

     2 /aWorking/Zsh/Source/Wk 0 $ . testing
     tree: Missing argument to -L option.

If I use 'eval' it's fine.  Now, I roughly understand that we need 
'eval' when there's some complicated nesting of expansions or some other 
complexity, but I also recall that in almost every case where I've 
discussed an 'eval' here, I've been shown that it isn't really needed.  
In this case the expansion seems so trivial that I'm puzzled.  If 
'level' were some other switch that didn't require a space in it ('tree' 
demands a space between the 'L' and the number) then it works without 
eval, but what's the issue?  The '2' is there, why does 'tree' not see 
it?  Is this one of those invisible bogeys?  Something about argument 
counts or such?  But quoting didn't change the error message.



[-- Attachment #2: Type: text/html, Size: 1224 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-11-21  2:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19 14:34 why is eval needed? 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

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).