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

Re: append to history entry?



On 27/12/16 08:00 AM, Bart Schaefer wrote:
On Dec 27, 12:55pm, Daniel Shahaf wrote:
}
}     print -rS -- "rap ${(q)@} ; : ${(q)HOST}"

Well, if we're being really pedantic, that's not right either, because
print -S requires a single string argument, but ${(q)@} in double quotes
results in multiple strings quoted individually, whereas ${(q)*} results
in backslashing the spaces between the arguments.

An extra level of nested expansion fixes that, and for readability it'd
be better to use (q+) on the arguments and (q-) on the host name:

     print -rS -- "rap ${${(q+)@}} ; : ${(q-)HOST}"

Jesus! I'm goin' back, to where ah' come from. ;-)

Seriously, I wish I knew if stuff like that really is part of the best of all possible worlds or if it is a case of fundamental errors in design of the first shells gradually accumulating more and more band-aids as time went on until we have exceptions to the exceptions to the exceptions and funny little gotchas within funny little gotchas. Can't we have "print --Just-Do-It" ? Anyway I'll take the above on faith.


One thing tho Bart, it seems it should be 'echo' because when the command line is recalled and executed, the colon throws an error whereas the 'echo' just dumbly prints the host name which is harmless. Anyway I'm intrigued by the idea of sending little messages to history like this. As it is, I just 'echo' messages to myself which are of course there in history to remind me what I was doing at the time. But maybe this whole thing is a bit smart-assy. Thanks gentlemen.




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