Permalink
Browse files
quote path variables in shell script
- Loading branch information...
Showing
with
8 additions
and
8 deletions.
-
+8
−8
minced
|
|
@@ -4,11 +4,11 @@ |
|
|
# readlink is different between BSD and Linux,
|
|
|
# therefore this loop recreates `readlink -f`
|
|
|
|
|
|
-ORIG_DIR=$(pwd $(dirname $0))
|
|
|
+ORIG_DIR=$(pwd $(dirname "$0"))
|
|
|
|
|
|
-cd $(dirname $0)
|
|
|
+cd $(dirname "$0")
|
|
|
|
|
|
-TARGET_FILE=$(basename $0)
|
|
|
+TARGET_FILE=$(basename "$0")
|
|
|
# Iterate down a (possible) chain of symlinks
|
|
|
i=0
|
|
|
while [ -L "$TARGET_FILE" ]
|
|
|
@@ -18,16 +18,16 @@ do |
|
|
echo "Link cycle detected in path, more than 1000 links traversed, exiting" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
- TARGET_FILE=$(readlink $TARGET_FILE)
|
|
|
- cd $(dirname $TARGET_FILE)
|
|
|
- TARGET_FILE=$(basename $TARGET_FILE)
|
|
|
+ TARGET_FILE=$(readlink "$TARGET_FILE")
|
|
|
+ cd $(dirname "$TARGET_FILE")
|
|
|
+ TARGET_FILE=$(basename "$TARGET_FILE")
|
|
|
i=$((i + 1))
|
|
|
done
|
|
|
|
|
|
# Compute the canonicalized name by finding the physical path
|
|
|
# for the directory we're in and appending the target file.
|
|
|
PHYS_DIR=`pwd -P`
|
|
|
|
|
|
-cd $ORIG_DIR
|
|
|
+cd "$ORIG_DIR"
|
|
|
|
|
|
-java -jar $PHYS_DIR/minced.jar "$@"
|
|
|
+java -jar "$PHYS_DIR"/minced.jar "$@"
|
0 comments on commit
3a00b6c