Skip to content

Commit 6190c94

Browse files
committed
Add quote to $OUT_FILE variable
1 parent 8ecb286 commit 6190c94

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

git-archive-all.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,19 @@ OUT_FILE=$OLD_PWD # assume "this directory" without a name change by default
193193

194194
if [ ! -z "$1" ]; then
195195
OUT_FILE="$1"
196-
if [ "-" == $OUT_FILE ]; then
196+
if [ "-" == "$OUT_FILE" ]; then
197197
SEPARATE=0
198198
fi
199199
shift
200200
fi
201201

202202
# Validate parameters; error early, error often.
203-
if [ "-" == $OUT_FILE -o $SEPARATE -ne 1 ] && [ "$FORMAT" == "tar" -a `$TARCMD --help | grep -q -- "--concatenate"; echo $?` -ne 0 ]; then
203+
if [ "-" == "$OUT_FILE" -o $SEPARATE -ne 1 ] && [ "$FORMAT" == "tar" -a `$TARCMD --help | grep -q -- "--concatenate"; echo $?` -ne 0 ]; then
204204
echo "Your 'tar' does not support the '--concatenate' option, which we need"
205205
echo "to produce a single tarfile. Either install a compatible tar (such as"
206206
echo "gnutar), or invoke $PROGRAM with the '--separate' option."
207207
exit
208-
elif [ $SEPARATE -eq 1 -a ! -d $OUT_FILE ]; then
208+
elif [ $SEPARATE -eq 1 -a ! -d "$OUT_FILE" ]; then
209209
echo "When creating multiple archives, your destination must be a directory."
210210
echo "If it's not, you risk being surprised when your files are overwritten."
211211
exit
@@ -265,7 +265,7 @@ if [ $VERBOSE -eq 1 ]; then
265265
echo -n "concatenating archives into single archive..."
266266
fi
267267
# Concatenate archives into a super-archive.
268-
if [ $SEPARATE -eq 0 -o "-" == $OUT_FILE ]; then
268+
if [ $SEPARATE -eq 0 -o "-" == "$OUT_FILE" ]; then
269269
if [ $FORMAT == 'tar.gz' ]; then
270270
gunzip $superfile
271271
superfile=${superfile:0: -3} # Remove '.gz'
@@ -299,7 +299,7 @@ if [ $VERBOSE -eq 1 ]; then
299299
echo -n "moving archive to $OUT_FILE..."
300300
fi
301301
while read file; do
302-
if [ "-" == $OUT_FILE ]; then
302+
if [ "-" == "$OUT_FILE" ]; then
303303
cat "$file" && rm -f "$file"
304304
else
305305
mv "$file" "$OUT_FILE"

0 commit comments

Comments
 (0)