Would it make sense to use "$@" instead of $* in the argument expansion?

This occurs in get_source.sh, also in the new hgforest.sh.

The use of "$@" I believe preserves the command line argument parsing:
Assume this is script "asdf":

#!/bin/bash
echo quote-dollar-at-quote
for i in "$@" ; do
  echo "$i"
done
echo dollar-star
for i in $* ; do
  echo "$i"
done

./asdf "a b" c d

produces 

quote-dollar-at-quote
a b
c
d
dollar-star
a
b
c
d

This is a good habit in a multiplatform world, even given the (undocumented!) 
assumption that no subtree will have a space in its name.

David

On 2012-11-29, at 8:17 AM, Fredrik Öhrström <[email protected]> wrote:

> This patch makes sure that pressing ctrl-c when running "sh get_source.sh" 
> actually
> sends a nice TERM signal to the background mercurial processes so that they 
> can do
> a nice rollback, if they need to. Really useful, when that clone has stalled, 
> because
> your network is down, and you want to stop and retry later.
> 
> http://cr.openjdk.java.net/~ohrstrom/webrev-8004145-hgforest/
> 
> //Fredrik
> 
> 

Reply via email to