softwareupdate grep Script Help
softwareupdate prints No new software available. on stderr, not on stdout, so it will never get assigned to check. The quick fix is to run

check=$(softwareupdate -l 2&gt;&amp;1)


This will redirect stderr (file descriptor 2) to stdout (file descriptor 1). 

Also your if statement is wrong, the [ is a command, not just syntax. So you can simply run

if fgrep "No new software" &lt;&lt;&lt; $check; then


for this.

But if you don't need the value of $check later on you can put all this in one line and just run

if softwareupdate -l 2&gt;&amp;1 | fgrep -q "No new software"; then