logo separator

[mkgmap-dev] --bounds not accepting ~ (tilde)

From Marko Mäkelä marko.makela at iki.fi on Thu Feb 14 21:48:23 GMT 2013

Hi Gerd,

>to be precise:
>I tested with ubuntu default shell.
>
>java -jar mkgmap.jar ~/xyz.osm.pbf works
>java -jar mkgmap.jar --bounds=~/bounds_20121118.zip  xyz.osm
>gives file not found error for the bounds file

That would probably be the Bourne again shell (bash), which is the 
default interactive shell in Debian. It will expand ~ at the start of an 
argument, but not in the middle.

man 1 bash says:
>Tilde Expansion
>If a word begins with an unquoted tilde character (`~'), all of the 
>characters preceding the first unquoted slash (or all characters, if 
>there  is no unquoted slash) are considered a tilde-prefix.

Note the 'begins with'.

IMO the simplest solution would be to accept this syntax if it is not 
accepted yet:

java -jar mkgmap.jar --bounds ~/bounds_20121118.zip  xyz.osm

Then, the ~ would begin a word, and the shell would expand it.

A workaround is to write

java -jar mkgmap.jar --bounds="$HOME"/bounds_20121118.zip  xyz.osm

(I usually use "" around variables in shell scripts, in case the 
variable value contains $IFS characters, such as spaces. I guess that 
defining HOME='/home/j. random user' could break some badly written 
scripts.)

	Marko


More information about the mkgmap-dev mailing list