Posted on 11-20-2019 02:44 PM
I'm trying to create a workflow for our school in which a computer can be booted, will check for available software updates and apply any necessary, and then check in with our JSS once no more software updates are identified. I'm curious if anyone has a solution for capturing the server response from the softwareupdate command? So far when I run:
#!/bin/bash
su=$(softwareupdate -l)
echo "$su"
The terminal output is:
No new software available.
Server response and then:
Software Update Tool
Finding available software
Output of echo "$su"
With the server response "No new software available." printing first and without regard for the output of the echoed variable. In other words I only ever seem to be able to programmatically capture "Software Update Tool" and "Finding available software". Does anyone have a solution for capturing the server response from the softwareupdate command?
Solved! Go to Solution.
Posted on 11-20-2019 02:52 PM
Try redirecting stderr to stdout:currentupdates=$(softwareupdate -l 2>&1)
Also, I'd recommend either using this script directly or taking ideas from it.
Edit - the $su thing won't be a problem.
Posted on 11-20-2019 02:52 PM
Try redirecting stderr to stdout:currentupdates=$(softwareupdate -l 2>&1)
Also, I'd recommend either using this script directly or taking ideas from it.
Edit - the $su thing won't be a problem.
Posted on 11-21-2019 09:07 AM
Thanks @cbrewer! That JSS script should do the trick.