echo 'show State:/Users/ConsoleUser' | scutil | awk '/kCGSSessionUserNameKey/ { print $3 }'echo 'show State:/Users/ConsoleUser' -- Echo a command to scutil
scutil -- Take piped input from echo above.
awk '/kCGSSessionUserNameKey/ { print $3 }' -- Find the line kCGSSessionUserNameKey and print 3rd item (The Username).
scutil -- Manage system configuration parameters. You can find the scutil man page here
No comments:
Post a Comment