David-Haim-zz/swtoolkit

mandelbrot sample doesn’t work if the current directory has spaces

GoogleCodeExporter opened this issue · 1 comments

http://code.google.com/p/swtoolkit/source/browse/trunk/samples/mandelbrot/hammer

#!/bin/sh
# find where this script is
SCRIPT_DIR=$(dirname $(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,"))
# run the main script
$SCRIPT_DIR/../../hammer.sh $*

Problems with this two-line shell script:
- You need quotes around "$( ... )" to protect from pathname expansion
- The dirname needs a -- before the argument
- You need quotes around "${0}" in case a parent directory name contains spaces
- You need quotes around "${SCRIPT_DIR}/../../hammer.sh"
- $* should be "${@}" in case an argument contains a space
- When the last line of a wrapper script just calls a different program,
you should exec it so there is one less process in the system (unless you
have outstanding traps)

Original issue reported on code.google.com by neit...@gmail.com on 14 Feb 2009 at 1:32

Fixed in r40

Original comment by rspangle...@gmail.com on 27 Feb 2009 at 10:03

  • Changed state: Fixed