#!/bin/sh

if [ -z "$1" ]
then
  echo "Usage: $0 URL [TAG]"
  echo "  URL: The URL to open"
  echo "  TAG: The anchor at that url"
  exit 1
fi

if [ -z "$2" ]
then
  TAG=''
else
  TAG="#$2"
fi 

if mozilla -remote openFile\(file://$1$TAG\) ; then
    exit 0
else
    mozilla file://$1$TAG
fi 
exit 0
