Last active
June 15, 2020 05:04
-
-
Save xunlao/270da5321c8df047d2b8f05addf0a6fc to your computer and use it in GitHub Desktop.
Launch App based on if some website is accessible or not (i.e. in company network or at home)
This file contains 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
# https://stackoverflow.com/questions/22009364/is-there-a-try-catch-command-in-bash | |
echo "checking the network work/home.." | |
sleep 5; | |
{ # try | |
curl www.vmware.com && { # need to wrap using {} | |
echo "try pass; open working app" | |
open "/Applications/Microsoft Outlook.app/" | |
open "/Applications/Firefox.app/" | |
} | |
#save your output | |
} || { # catch | |
# save log for exception | |
echo "at home"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment