The "$@" parameter in Bourne shells (at least) interpolates arguments while splitting tokens in the way they were provided. In other words, "$@" expands to "$1" "$2"... It is currently not possible to achieve this in Mercurial. In a POSIX shell: $ cat echotokens #!/bin/sh printf "%s\n" "$@" $ ./echotokens foo 'bar $1 baz' foo bar $1 baz In Mercurial, the closest equivalents are $@ (without quotes) and '$@' (with single quotes). Neither of those are exact matches, however. The following tests are with hg @ 43054dc84abd. $ hg showconfig alias.echotokens !printf "%s\n" $@ $ hg echotokens foo 'bar $1 baz' foo bar baz $ hg showconfig alias.echotokens !printf "%s\n" '$@' $ hg echotokens foo 'bar $1 baz' foo bar $1 baz $ hg showconfig alias.echotokens !printf "%s\n" "$@" $ hg echotokens foo 'bar $1 baz' foo bar baz
Fixed by http://selenic.com/repo/hg/rev/bc2132dfc0a4 Siddharth Agarwal <sid0@fb.com> alias: expand "$@" as list of parameters quoted individually (BC) (issue4200) Before this patch, there was no way to pass in all the positional parameters as separate words down to another command. (1) $@ (without quotes) would expand to all the parameters separated by a space. This would work fine for arguments without spaces, but arguments with spaces in them would be split up by POSIX shells into separate words. (2) '$@' (in single quotes) would expand to all the parameters within a pair of single quotes. POSIX shells would then treat the entire list of arguments as one word. (3) "$@" (in double quotes) would expand similarly to (2). With this patch, we expand "$@" (in double quotes) as all positional parameters, quoted individually with util.shellquote, and separated by spaces. Under standard field-splitting conditions, POSIX shells will tokenize each argument into exactly one word. This is a backwards-incompatible change, but the old behavior was arguably a bug: Bourne-derived shells have expanded "$@" as a tokenized list of positional parameters for a very long time. I could find this behavior specified in IEEE Std 1003.1-2001, and this probably goes back to much further before that. (please test the fix)