Hello,
Looking for help on my current bash script to reinstall the JSS management. Everything is working except I cant figure out how to search every line of the output to the command variable.
#!/bin/bash
jss_comm_chk=$(jamf checkJSSConnection& sleep 2; kill $! > /dev/null; echo $?)
if [[ "$jss_comm_chk" == *"JSS is available"* ]]
then
echo "JSS binary already installed. Attempting to reinstall..."
sudo jamf removeFramework
sleep 2
sudo installer -pkg /Library/CE/security/installers/Casper/QuickAdd.pkg -target /
sleep 2
fi
if [[ "$jss_comm_chk" == *"command not found"* ]] #FAILS TO SEARCH HERE
then
echo "JSS binary not currently installed. Attempting to install..."
sudo installer -pkg /Library/CE/security/installers/Casper/QuickAdd.pkg -target /
fi
if [[ "$jss_comm_chk" == *"Waiting 5"* ]]
then
echo "No internet connection. Please connect to any network BESIDES CorpWifi."
fi
This is the output of the variable above where its failing:
[1] 71021
-bash: jamf: command not found
[1]+ Exit 127 jamf checkJSSConnection
-bash: kill: (71021) - No such process
1