Created
November 21, 2021 16:48
-
-
Save macmule/f5e49cf2a362fac8ddb4efa00471c508 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| #################################################################################################### | |
| # | |
| # License: https://macmule.com/license/ | |
| # | |
| #################################################################################################### | |
| # | |
| # DEFINE VARIABLES & READ IN PARAMETERS | |
| # | |
| #################################################################################################### | |
| # HARDCODED VALUE FOR "PATHTOEXTENSION" IS SET HERE | |
| pathToExtension="" | |
| # CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 4 AND, IF SO, ASSIGN TO "PATHTOEXTENSION" | |
| if [ "$4" != "" ] && [ "$pathToExtension" == "" ];then | |
| pathToExtension=$4 | |
| fi | |
| # Error if variable appName is empty | |
| if [ "$pathToExtension" == "" ]; then | |
| echo "Error: No value was specified for the pathToExtension variable..." | |
| exit 1 | |
| fi | |
| #################################################################################################### | |
| ### Launch Safari if not open | |
| osascript -e 'tell application "Safari" | |
| activate | |
| end tell' | |
| ### Prompt the user to install the extension given @ $4 | |
| osascript -e 'tell application "Safari" | |
| open "'"$pathToExtension"'" | |
| end tell' | |
| ### Exit silently, as will error if exists & if times out for whatever reason | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment