On Wed, Mar 19 2014, Jani Nikula <jani at nikula.org> wrote: > On Wed, 19 Mar 2014, Tomi Ollila <tomi.ollila at iki.fi> wrote: >> On Wed, Mar 19 2014, Jani Nikula <jani at nikula.org> wrote: >> >>> + >>> +# Positional parameters. >>> +while [ $# -gt 0 ]; do >>> + ELISP="${ELISP} (message-goto-to) (insert \"${1}, \")" >>> + shift >>> +done >> >> for arg; do > > for arg in $@; ?
Yes, that is less obfuscated version of that, whichever you feel more comfortable with... for more discussion about the alternatives here see: http://www.in-ulm.de/~mascheck/various/bourne_args/ (but don't look that -- it is unnecessary and only causes headache ;D) >> maybe arg=${arg//\\/\\\\}; arg=${arg//"/\\"}; >> >> ${parameter/pattern/string} -- Pattern substition in bash manual. > > I'm inclined to go with "don't do that then" ;) $ bash -c 'arg=${0//\\/\\\\}; echo ${arg//\"/\\\"}' 'this"is\a test' this\"is\\a test $ zsh -c 'arg=${0//\\/\\\\}; echo ${arg//\"/\\\"}' 'this"is\a test' this\"is\a test $ ksh -c 'arg=${0//\\/\\\\}; echo ${arg//\"/\\\"}' 'this"is\a test' this\"is\\a test Interestigly zsh on Scientific Linux 6.2 fails here (zsh 4.3.10) -- I tried various tricks and none helped. Hmm also zsh 4.3.17 on Ubuntu 12.04 fails. zsh 5.0.2 on Fedora 20 works OK. ksh & bash installed on all these 3 systems work OK (and also bash 3.2.51... on Mac OS X). IMO this quoting should be done -- so I can send you email with: $ notmuch-emacs-mua '"Jani Nikula" <jani at nikula.org>' Tomi