summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@unpythonic.net>2014-06-08 10:35:41 -0500
committerChris Radek <chris@timeguy.com>2014-06-08 16:51:17 -0500
commitd131cf17057ed7e9148b6bea3c42cbdaf1748a05 (patch)
tree43b4fc938b296ad1e634a374fd179c1495d6ab04
parent5f60f93abce57c796cbeb380ba5d8c4ca488d80c (diff)
downloadlinuxcnc-d131cf17057ed7e9148b6bea3c42cbdaf1748a05.tar.gz
linuxcnc-d131cf17057ed7e9148b6bea3c42cbdaf1748a05.zip
runscript: fix regression for ini names that include shell special characters
-rw-r--r--scripts/linuxcnc.in42
1 files changed, 21 insertions, 21 deletions
diff --git a/scripts/linuxcnc.in b/scripts/linuxcnc.in
index 082aaa3df..c7484e321 100644
--- a/scripts/linuxcnc.in
+++ b/scripts/linuxcnc.in
@@ -275,52 +275,52 @@ fi
function handle_includes () {
hdr="# handle_includes():"
- inifile=$1
- cd $(dirname $inifile) ;# for the function() subprocess only
- grep "^#INCLUDE" $inifile >/dev/null
+ inifile="$1"
+ cd "$(dirname $inifile)" ;# for the function() subprocess only
+ grep "^#INCLUDE" "$inifile" >/dev/null
status=$?
if [ $status -ne 0 ] ; then
echo "$inifile" ;# just use the input
return 0 ;# ok
fi
- outfile=$(dirname $inifile)/$(basename $inifile).expanded
- >|$outfile
- echo "#*** $outfile" >>$outfile
- echo "#*** Created: $(date)" >>$outfile
- echo "#*** Autogenerated file with expanded #INCLUDEs" >>$outfile
- echo "" >>$outfile
+ outfile="$(dirname $inifile)/$(basename $inifile).expanded"
+ >|"$outfile"
+ echo "#*** $outfile" >>"$outfile"
+ echo "#*** Created: $(date)" >>"$outfile"
+ echo "#*** Autogenerated file with expanded #INCLUDEs" >>"$outfile"
+ echo "" >>"$outfile"
line=0
while read a b ; do
line=$((line + 1))
if [ "$a" = "#INCLUDE" ] ; then
if [ "X$b" = "X" ] ; then
- msg="$hdr <$line> found #INCLUDE with no filename" >>$outfile
+ msg="$hdr <$line> found #INCLUDE with no filename" >>"$outfile"
echo "$msg" >&2
- echo "$msg" >>$outfile
+ echo "$msg" >>"$outfile"
else
# expand file name
breal=$(eval echo "$b")
# -r: readable
if [ -r "$breal" ] ; then
- echo "" >>$outfile
- echo "#*** Begin #INCLUDE file: $breal" >>$outfile
- cat "$breal" >>$outfile
- echo "#*** End #INCLUDE file: $breal" >>$outfile
+ echo "" >>"$outfile"
+ echo "#*** Begin #INCLUDE file: $breal" >>"$outfile"
+ cat "$breal" >>"$outfile"
+ echo "#*** End #INCLUDE file: $breal" >>"$outfile"
else
msg="$hdr <$line> CANNOT READ $breal"
echo "$msg" >&2
- echo "$msg" >>$outfile
+ echo "$msg" >>"$outfile"
fi
fi
else
- echo "$a $b" >> $outfile
+ echo "$a $b" >> "$outfile"
fi
- done <$inifile
- echo $outfile ;# use the expanded file
+ done <"$inifile"
+ echo "$outfile" ;# use the expanded file
return 0 ;# ok
}
-INIFILE=$(handle_includes $INIFILE)
+INIFILE="$(handle_includes "$INIFILE")"
# delete directories from path, save name only
INI_NAME="${INIFILE##*/}"
@@ -340,7 +340,7 @@ if [ ! -f "$INIFILE" ] ; then
trap '' EXIT
exit -1
fi
-echo INIFILE=$INIFILE >>$PRINT_FILE
+echo INIFILE="$INIFILE" >>$PRINT_FILE
################################################################################
# 2. extract info from the ini file that we will need later