I use multiple browsers, and I created a bash script that checks to see which browser is open and opens web pages in whatever browser is already open. I use Windows 7, so I run this script using Cygwin. I set the script as the default browser by editing the appropriate registry entries, so whenever any program tries to open a web page, it calls this script using Cygwin's "--login" parameter. The script works - pages get loaded in whatever browser is open. However, whenever the script is called by another program, I get the error message, "There was a problem sending the command to the program." The script works, but I get the error message anyway. This only happens when the script is called by another program - there's no error message if I run the script directly from the command line.
I don't know if the script is at fault, but here it is:
#! /bin/bash
if ps -W | grep -v grep | grep waterfox.exe >/dev/null
then
"/cygdrive/c/Program Files/Waterfox/waterfox.exe" -requestPending -osint -url "$1"
elif ps -W | grep -v grep | grep firefox.exe >/dev/null
then
"/cygdrive/c/Program Files (x86)/Mozilla Firefox/firefox.exe" -requestPending -osint -url "$1"
elif ps -W | grep -v grep | grep chrome.exe >/dev/null
then
"/cygdrive/c/Users/Morgan/AppData/Local/Google/Chrome/Application/chrome.exe" -- "$1"
else
cygstart "/cygdrive/c/Program Files/Waterfox/waterfox.exe" -requestPending -osint -url "$1"
fi
exit
I tried changing the last line to "exit 0" on the theory that there was some problem with the exit status, but that had no effect.
I'd really appreciate it if someone wiser in the ways of Cygwin and/or Windows could enlighten me. Thanks!