rheather88 / swtoolkit

Automatically exported from code.google.com/p/swtoolkit
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
Fixed in r40

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