I have written the following bash script for a friend to add as a menu item and would like some input on it:
Code:
#!/bin/bash
# Filename: browseropen.sh
# Version: 0.1
# Date: April 13, 2010
# Author: Ian MacGregor (aka ardchoille)
# License: GPL
# Requires: firefox, zenity
# Description: This script opens a user-supplied URL in the firefox web browser
myurl=`zenity --entry --title="Firefox - Open Webpage" --text="Please enter a URL:" --entry-text ""`
# The zenity text entry dialog consist of “ok” and “cancel” buttons.
# When user clicks “ok” it returns 0, “cancel” returns 1.
# If user clicks the "cancel" button
if [ $? == 1 ]
then
exit 1
# If user clicks the "ok" button and text box is empty
elif [ -z $myurl ]
then
exit 1
fi
# Open the specified URL in a new tab if firefox is running.
# Otherwise open in a new instance of firefox.
firefox -new-tab $myurl
exit
The script works correctly, I was just wondering if the syntax is correct or if it would cause any unforeseen problems.
Bookmarks