Hey Guys,
In a pickle with a simple IF statement. I am assigning the output of a command to a variable. But this command can hang for some time and so I figured out how to simply kill it. This command is checking for a connection to a specific server. The problem is there are multiple lines and I'm trying to search for keywords but no luck. Attempted some variations of GREP too. What am I missing?
Here is the script simplified:
One output of the command would be:
In a pickle with a simple IF statement. I am assigning the output of a command to a variable. But this command can hang for some time and so I figured out how to simply kill it. This command is checking for a connection to a specific server. The problem is there are multiple lines and I'm trying to search for keywords but no luck. Attempted some variations of GREP too. What am I missing?
Here is the script simplified:
Code:
#!/bin/bash
jss_comm_chk=$(jamf checkJSSConnection& sleep 2; kill $! > /dev/null; echo $?)
if [[ "$jss_comm_chk" == *"JSS is available"* ]]; then
echo "JSS binary installed. Attempting to reinstall......"
if [[ "$jss_comm_chk" == *"command not found"* ]]; then
echo "JSS binary not currently installed. Attempting to install....."
else
echo "No Internet Connection"
fi
fi
One output of the command would be:
Code:
[1] 77856
Checking availability of https://jss.corp.mycompany.com:8223/...
The JSS is available.
[1]+ Done jamf checkJSSConnection
-bash: kill: (77856) - No such process
1