logo separator

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

From Rich richlv at nakts.net on Thu Feb 14 22:06:24 GMT 2013

On 2013-02-14 23:48, Marko Mäkelä wrote:
> 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'.

that's different. that part refers to tilde prefix being ~<username> - 
for example, ~rich would be my home directory, but ~user would be user's 
home directory.

that's not bash specific - it is a unix-specific concept, and it is the 
current user's home directory. it would be really nice if it was also 
supported in scenarios like --bounds=~/user/bounds

hmm, turns out wikipedia page on tilde even has a section on "computing" :)

http://en.wikipedia.org/wiki/Tilde#Directories_and_URLs

> 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
-- 
  Rich


More information about the mkgmap-dev mailing list