Fix the use of $@ in all shell scripts
This patch allows all our development scripts, as well as ndk-gdb
to work well when parameters containing spaces are used.
The $@ shell variable is very special because it will expand
differently if inside a quoted string. What this means is that,
while $@ normally corresponds to the list of all parameters to
a function or script, we have:
$@ -> expands to a single string
"$@" -> expands to a series of strings
This is important when using them as parameters to other commands
for example consider:
# Simple function to dump all parameters, one per line.
dump () {
for ITEM; do
echo "$ITEM"
done
}
dump1 () { # this will always print a single line
dump $@
}
dump2 () { # this will print one line per item
dump "$@"
}
dump1 aaa bbb ccc # prints "aaa bbb ccc" on a single line
dump2 aaa bbb ccc # prints three lines: "aaa", "bbb" and "ccc"
Generally speaking, one should always use "$@" except in very rare cases
(e.g. when called from an eval command).
Change-Id: I87ec2a7b078cbe463f0ec0257ecad8fd38835b2e
4 files changed