From e2c74cba0311d2ac689ac8ddc149bc1396000758 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 24 Apr 2012 13:59:20 +0200 Subject: bashrc/common/browser: refactor script to make it more flexible --- bashrc/common/browser.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'bashrc/common') diff --git a/bashrc/common/browser.sh b/bashrc/common/browser.sh index 1f610f0..7dc6bd2 100644 --- a/bashrc/common/browser.sh +++ b/bashrc/common/browser.sh @@ -1,13 +1,12 @@ # browser options -# but user opera, if available -if hash opera > /dev/null 2>&1 ; then - export BROWSER=opera -else - - # use firefox by default ... - if hash firefox > /dev/null 2>&1 ; then - export BROWSER=firefox - fi -fi +# check in this order for existence and use the first available +browser="x-www-browser opera chromium google-chrome firefox" + +for b in $browser ; do + if hash $b > /dev/null 2>&1 ; then + export BROWSER=$b + break + fi +done -- cgit v1.2.3