[GRASS-dev] Variable quoting problem (and solution)
Markus Neteler
neteler at osgeo.org
Sun Jan 30 07:26:13 EST 2011
Hi,
in 6.4 (and later) there is still a quoting problem. Together with Helmut,
I reduced the existing problems to this one (example v.in.geonames):
GRASS 6.4> v.in.geonames input=C:\dl\AT\AT.txt output=vgeotest6
+ '[' -z '/C/Program Files/GRASS 6.4.SVN' ']'
+ '[' input=C:dlATAT.txt '!=' @ARGS_PARSED@ ']'
++ basename /C/Program Files/GRASS 6.4.SVN/scripts/v.in.geonames
basename: extra operand `6.4.SVN/scripts/v.in.geonames'
Try `basename --help' for more information.
+ CMDLINE=
+ for arg in '"$@"'
+ CMDLINE=' "input=C:dlATAT.txt"'
+ for arg in '"$@"'
+ CMDLINE=' "input=C:dlATAT.txt" "output=vgeotest6"'
+ export CMDLINE
+ exec g.parser '/C/Program Files/GRASS 6.4.SVN/scripts/v.in.geonames'
input=C:dlATAT.txt output=vgeotest6
basename: extra operand `6.4.SVN/scripts/v.in.geonames'
Try `basename --help' for more information.
FEHLER: File 'C:dlATAT.txt' not found
GRASS 6.4>
Patching the script like this:
--- scripts/v.in.geonames/v.in.geonames (revision 45246)
+++ scripts/v.in.geonames/v.in.geonames (working copy)
@@ -49,7 +49,7 @@
# save command line
if [ "$1" != "@ARGS_PARSED@" ] ; then
- CMDLINE="`basename $0`"
+ CMDLINE=`basename "$0"`
for arg in "$@" ; do
CMDLINE="$CMDLINE \"$arg\""
done
@@ -57,7 +57,7 @@
exec g.parser "$0" "$@"
fi
-PROG="`basename $0`"
+PROG=`basename "$0"`
we now get
GRASS 6.4> v.in.geonames input="C:\dl\AT\AT.txt" output=vgeotest9
+ '[' -z '/C/Program Files/GRASS 6.4.SVN' ']'
+ '[' 'input=C:\dl\AT\AT.txt' '!=' @ARGS_PARSED@ ']'
++ basename '/C/Program Files/GRASS 6.4.SVN/scripts/v.in.geonames'
+ CMDLINE=v.in.geonames
+ for arg in '"$@"'
+ CMDLINE='v.in.geonames "input=C:\dl\AT\AT.txt"'
+ for arg in '"$@"'
+ CMDLINE='v.in.geonames "input=C:\dl\AT\AT.txt" "output=vgeotest9"'
+ export CMDLINE
+ exec g.parser '/C/Program Files/GRASS 6.4.SVN/scripts/v.in.geonames'
'input=C:\dl\AT\AT.txt' output=vgeotest9
...
which looks fine. So I'll change all scripts accordingly.
Markus
More information about the grass-dev
mailing list