[GRASS5] Re: sqlite browser
Paul Kelly
paul-grass at stjohnspoint.co.uk
Sun Nov 13 18:52:39 EST 2005
Hello Hamish & Michael
Hamish wrote:
>>Perhaps an environmental variable like SQL_BROWSER_PATH might be
>>useful, given that the name (on my Mac at least) is full of spaces and
>>has an embedded version number which will change with every update.
>>Some kind of find that could return the name and path the the browser
>>could automate this.
>
> I don't think anything new or fancy is needed-
>
> SQLITE_BROWSER="`which sqlitebrowser`"
>
> should be enough. If a path with a space in it doesn't work, then it is
> a variable quoting bug which should be systematically fixed. The browser
> executable needs to be in the $PATH, that isn't a big ask.
> Worst case make a symlink to it in /usr/local/bin or $GISBASE/bin/.
See also point 22 in SUBMITTING:
http://freegis.org/cgi-bin/viewcvs.cgi/*checkout*/grass6/SUBMITTING
22. If you write a shell script and search for a command in $PATH, do
NOT use the "which" command or the "type -p" command. Both commands are
not supported on all platforms, thus causing problems for some people.
As an alternative, please use code similar to the following shell script
snippet which will perform the same function. In this case, the path of
the grass60 command is saved if grass60 is found in $PATH. This won't
recognize aliased command name.
# Search for grass5 command in user's path
for i in `echo $PATH | sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g'`
do
if [ -f $i/grass5 ] ; then
# Save the path of the grass60 command
GRASS_PATH=$i/grass60
# Use the first one in user's path
break
fi
done
(although it looks like someone has done a search and replace updating
grass5 to grass6 on this and slightly messed up the example!)
Paul
:)
More information about the grass-dev
mailing list