Last active
November 15, 2023 17:09
-
-
Save MichaelDimmitt/f9931a66bfc24e40e91aa4c8ec52cdd1 to your computer and use it in GitHub Desktop.
open_command.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__find_open_command_from_Operating_System() { | |
local open_cmd | |
OSTYPE="$(uname -s | tr 'A-Z' 'a-z')" | |
case "$OSTYPE" in | |
darwin*) open_cmd='open' ;; | |
cygwin*) open_cmd='cygstart' ;; | |
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || { | |
open_cmd='cmd.exe /c start ""' | |
} ;; | |
msys*) open_cmd='start ""' ;; | |
*) echo "Platform $OSTYPE not supported" | |
return 1 | |
;; | |
esac | |
echo "$open_cmd" | |
} | |
# run the function and use it to open https://www.google.com, see below: | |
$(__find_open_command_from_Operating_System) https://www.google.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment