%% UNIX: Save Command Exit Status and Output
% List all users who are currently logged in, and save the command exit status and output. Then, view the status. A status of zero indicates that the command completed successfully. MATLAB® returns a list of users in cmdout.

command = 'who';
[status,cmdout] = system(command);
status

%
% Copyright 2012 The MathWorks, Inc.