Tag Archives: Script

MacOS – Script – Getting the logged in user

loggedInUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) For more details see: https://scriptingosx.com/2019/09/get-current-user-in-shell-scripts-on-macos/

Posted in Labs | Tagged , , | Comments Off on MacOS – Script – Getting the logged in user