added xdg-open/open logic to URL opening
1 files changed, 9 insertions(+), 3 deletions(-)

M dpaste.sh
M dpaste.sh +9 -3
@@ 35,10 35,16 @@ while getopts hs:t:p:e: opt; do
 done
 shift "$((OPTIND-1))"
 
-echo -e "Paste your content now, ^D to submit.\n---"
+echo "Paste your content now, ^D to submit.\n---"
 
 # make the API call
 url=$(curl -s -F "content=<-" $params http://dpaste.com/api/v2/)
 echo -e "---\n$url"
-# open the resulting paste
-xdg-open $url
+
+# open in browser
+if [ -x "$(command -v xdg-open)" ];
+then
+    xdg-open $url
+else
+    open $url
+fi