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

Re: append to history entry?



Ray Andrews wrote on Mon, Dec 26, 2016 at 17:28:05 -0800:
>    print -S "rap $* ; echo $HOST"

This will not reproduce arguments with literal whitespace or backslashes
correctly.  Two changes are required to support them:

1) Pass -r to print.

2) When interpolating a variable into a command, it should be
(q)-esacped.

Putting all that and Bart's suggestion together gives:

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

[just in case somebody puts a backslash in their hostnames ;)]

Cheers,

Daniel



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