Originally Posted by Mr. Swillis
Well, that worked just fine with Firefox. I still need to test with galleon and netscape, but my guess is that it will work just fine. Now I feel kinda dumb for not thinking to pass the URL as a command line argument
Glad that it worked for you.
The $BROWSER variable is usually set by your distro, if not, the users can always do it themselves in .bashrc or .bash_profile
You can as well just hardcode the browser, that that's less flexible.
The best solution would be to add some checks into the script to:
if the $BROWSER string is not empty
if $BROWSER is executable
if firefox is executable run it
if konqueror executable run it
xmessage "no working browser was found"
This is easy to code in bash, a -x test checks if a file is executable. If successful, that directly implies it's somewhere on the user $PATH and it's readable and executable by that user.
To check for non empty variables use -n, to check for zero length use -z. The rest is just if...else...fi. This way, you ensure that the script is going to behave under extreme circumstances.