Skip to content

Instantly share code, notes, and snippets.

@xunlao
Last active June 15, 2020 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xunlao/270da5321c8df047d2b8f05addf0a6fc to your computer and use it in GitHub Desktop.
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)
# 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