Skip to content

Instantly share code, notes, and snippets.

@cvmat
Last active January 15, 2016 01:39
Show Gist options
  • Save cvmat/4442244 to your computer and use it in GitHub Desktop.
Save cvmat/4442244 to your computer and use it in GitHub Desktop.
A script invoking Firefox on Cygwin.
#! /bin/sh
# Confirm that the script is invoked from a Windows session,
# not a SSH session.
if [ -z "$SESSIONNAME" ] ; then
exit;
fi
alias firefox='/cygdrive/c/Program\ Files\ \(x86\)/Mozilla\ Firefox/firefox.exe'
if (echo $1 | egrep --silent "^file:///") then
# the file exists in the local machine
PATH_OF_LOCAL_FILE=`echo $1 | sed 's/file:\/\///'`;
URL=file:///`cygpath --mixed $PATH_OF_LOCAL_FILE `
elif (echo $1 | egrep --silent "^file://[^/]") then
# the file exists in the remote machine on network
PATH_OF_REMOTE_FILE=`echo $1 | sed 's/file://'`;
URL=file:///`cygpath --mixed $PATH_OF_REMOTE_FILE `
else
URL=$1
fi
#firefox -remote 'OpenURL('$URL',new-tab)'
firefox -new-tab $URL &
@Cheezmeister
Copy link

Or perhaps just: cygstart $URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment