Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

why is eval needed?



 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.





Messages sorted by: Reverse Date, Date, Thread, Author