senthor
senthor

Reputation: 113

How to catch softwareupdate output

I'm trying to catch the output of the softwareupdate command under OS X. softwareupdate -l >> somefile does only catch the first few lines (Software Update Tool Copyright 2002-2012 Apple Inc. Finding available software), the rest is missing (No new software available.) I need it for a bash script.

Current catching code: update=$(softwareupdate -l);

Any help is appreciated.

Upvotes: 0

Views: 697

Answers (1)

konsolebox
konsolebox

Reputation: 75548

Try redirecting stderr messages as well. Command substitution only captures output sent to stdout (fd 1; stderr = fd 2).

update=$(softwareupdate -l 2>&1)

Upvotes: 2

Related Questions