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

psychiatric help



This is a difficult question to ask because I don't know if my little problem IS a problem at all:

5 /aWorking/Zsh/Source/Wk 11 % ls test\ ?
'test a'  'test b'

... yer basic 'ls'.  'l' is my wrapper around 'ls', however as '$@' is passed to my function, it loses the backslash before the space, it becomes: >    test ?    <.  Easy to cope with, I just single quote:

5 /aWorking/Zsh/Source/Wk 11 % l ,v 'test\ ?'

 0 [26-04-04--09:00] test a
 0 [26-04-04--09:03] test b

... but my sense of symmetry has me wanting the args to look identical. I can hack it by replacing '$@' like this in test function 'll':

out=${@//\ /\\ }

... and using '$out' in place of '$@' and it works by doubling the backslash:

5 /aWorking/Zsh/Source/Wk 11 %  ll test\ ?

 0 [26-04-04--09:00] test a
 0 [26-04-04--09:03] test b

... but I'm wondering if there's a less hacky way of protecting the backslash.  ' ${(q)@}' comes close but it also backslashes the question mark.  Or should I use my little hack above, OR ... do I need therapy?  Which is to say, is this a problem at all?  Should I just happily add the single quotes?  Should I even want to 'solve' this?  Sorry, I know this is a rather strange post.  I'd be very happy to hear that this shouldn't bother me at all.  In practical terms it's hardly an issue.  But one could wish for some way of taking any argument(s) to a function and passing them along from one function to the next 'intact', so that there's never the need to reprocess them.   





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