Pages

Saturday, 30 June 2012

Useful to open firefox files under cygwin

I use cygwin extensively under windows. So I often need to open urls in firefox or in some other client. I finally found a was to implement this with simple alias and a bash function. It took me sometimes, but I guess or hope I learnt some thing.

You only need to put this in the .bashrc file or equivalent.

alias firefox='defCommand "/cygdrive/c/Program\ Files\ \(x86\)/Mozilla\
Firefox/firefox.exe"'

function defCommand(){
  PARAM=`cygpath -m $2`
  NEW_COMMAND="$1 file:$PARAM";
  eval $NEW_COMMAND
}