startup scripts: get rid of $* and replace it with properly quoted "$@"
In shell scripts an unquoted $* is rarely useful, for example because it breaks in presence of file names with spaces. References: - https://google.github.io/styleguide/shell.xml Use "$@" unless you have a specific reason to use $*. - https://unix.stackexchange.com/questions/41571/what-is-the-difference-between-and#94200 Short answer: use "$@" (note the double quotes). The other forms are very rarely useful.
This commit is contained in:
parent
695c2d2e84
commit
0a86024797
4 changed files with 8 additions and 8 deletions
|
@ -9,7 +9,7 @@ if [ -d "../bin" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ignoreRoot=0
|
ignoreRoot=0
|
||||||
for ARG in $*
|
for ARG in "$@"
|
||||||
do
|
do
|
||||||
if [ "$ARG" = "--root" ]; then
|
if [ "$ARG" = "--root" ]; then
|
||||||
ignoreRoot=1
|
ignoreRoot=1
|
||||||
|
@ -32,10 +32,10 @@ fi
|
||||||
rm -rf src/node_modules
|
rm -rf src/node_modules
|
||||||
|
|
||||||
#Prepare the environment
|
#Prepare the environment
|
||||||
bin/installDeps.sh $* || exit 1
|
bin/installDeps.sh "$@" || exit 1
|
||||||
|
|
||||||
#Move to the node folder and start
|
#Move to the node folder and start
|
||||||
echo "Started Etherpad..."
|
echo "Started Etherpad..."
|
||||||
|
|
||||||
SCRIPTPATH=`pwd -P`
|
SCRIPTPATH=`pwd -P`
|
||||||
node "${SCRIPTPATH}/node_modules/ep_etherpad-lite/node/server.js" $*
|
node "${SCRIPTPATH}/node_modules/ep_etherpad-lite/node/server.js" "$@"
|
||||||
|
|
|
@ -17,4 +17,4 @@ echo "Open 'chrome://inspect' on Chrome to start debugging."
|
||||||
|
|
||||||
#Use 0.0.0.0 to allow external connections to the debugger
|
#Use 0.0.0.0 to allow external connections to the debugger
|
||||||
#(ex: running Etherpad on a docker container). Use default port # (9229)
|
#(ex: running Etherpad on a docker container). Use default port # (9229)
|
||||||
node --inspect=0.0.0.0:9229 node_modules/ep_etherpad-lite/node/server.js $*
|
node --inspect=0.0.0.0:9229 node_modules/ep_etherpad-lite/node/server.js "$@"
|
||||||
|
|
|
@ -83,7 +83,7 @@ require_minimal_version "nodejs" "$NODE_VERSION_STRING" "$REQUIRED_NODE_MAJOR" "
|
||||||
#Get the name of the settings file
|
#Get the name of the settings file
|
||||||
settings="settings.json"
|
settings="settings.json"
|
||||||
a='';
|
a='';
|
||||||
for arg in $*; do
|
for arg in "$@"; do
|
||||||
if [ "$a" = "--settings" ] || [ "$a" = "-s" ]; then settings=$arg; fi
|
if [ "$a" = "--settings" ] || [ "$a" = "-s" ]; then settings=$arg; fi
|
||||||
a=$arg
|
a=$arg
|
||||||
done
|
done
|
||||||
|
|
|
@ -9,7 +9,7 @@ if [ -d "../bin" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ignoreRoot=0
|
ignoreRoot=0
|
||||||
for ARG in $*
|
for ARG in "$@"
|
||||||
do
|
do
|
||||||
if [ "$ARG" = "--root" ]; then
|
if [ "$ARG" = "--root" ]; then
|
||||||
ignoreRoot=1
|
ignoreRoot=1
|
||||||
|
@ -29,11 +29,11 @@ if [ "$(id -u)" -eq 0 ] && [ $ignoreRoot -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Prepare the environment
|
#Prepare the environment
|
||||||
bin/installDeps.sh $* || exit 1
|
bin/installDeps.sh "$@" || exit 1
|
||||||
|
|
||||||
#Move to the node folder and start
|
#Move to the node folder and start
|
||||||
echo "Started Etherpad..."
|
echo "Started Etherpad..."
|
||||||
|
|
||||||
SCRIPTPATH=`pwd -P`
|
SCRIPTPATH=`pwd -P`
|
||||||
exec node "$SCRIPTPATH/node_modules/ep_etherpad-lite/node/server.js" $*
|
exec node "$SCRIPTPATH/node_modules/ep_etherpad-lite/node/server.js" "$@"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue