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

Re: outputting quotes in a command



Eric Smith wrote:
> > print -r "mutt -f" ${(q):-foo} -e "'push \"<limit> ~f" ${(q):-bar} \
> >   "~d <2w'\$'\\r\"'"
> > 
> > That's really quite hairy:  you're outputting
> > 
> > mutt -f foo -e 'push "<limit> ~f bar ~d <2w'$'\r"'
> > 
> 
> This works fine when writing the command to a file and then 
> executing that file with zsh.
> 
> I would prefer to directly execute the resulting command.

Well, if you're simply executing the command rather than outputting it
then you just omit a level of quoting.

mutt -f foo -e 'push "<limit> ~f bar ~d <2w'$'\r"'

If bar is really a parameter you can do

mutt -f foo -e 'push "<limit> ~f '$bar' ~d <2w'$'\r"'

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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