{"id":1112,"date":"2019-09-06T08:48:10","date_gmt":"2019-09-06T13:48:10","guid":{"rendered":"http:\/\/sites.williams.edu\/lj1\/?p=1112"},"modified":"2019-09-06T08:48:10","modified_gmt":"2019-09-06T13:48:10","slug":"macos-script-getting-the-logged-in-user","status":"publish","type":"post","link":"https:\/\/sites.williams.edu\/lj1\/labs\/macos-script-getting-the-logged-in-user\/","title":{"rendered":"MacOS &#8211; Script &#8211; Getting the logged in user"},"content":{"rendered":"<p><code>loggedInUser=$( scutil &lt;&lt;&lt; &quot;show State:\/Users\/ConsoleUser&quot; | awk &#039;\/Name :\/ &amp;&amp; ! \/loginwindow\/ { print $3 }&#039; )<\/code><\/p>\n<p>For more details see:<br \/>\n<a href=\"https:\/\/scriptingosx.com\/2019\/09\/get-current-user-in-shell-scripts-on-macos\/\">https:\/\/scriptingosx.com\/2019\/09\/get-current-user-in-shell-scripts-on-macos\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>loggedInUser=$( scutil &lt;&lt;&lt; &quot;show State:\/Users\/ConsoleUser&quot; | awk &#039;\/Name :\/ &amp;&amp; ! \/loginwindow\/ { print $3 }&#039; ) For more details see: https:\/\/scriptingosx.com\/2019\/09\/get-current-user-in-shell-scripts-on-macos\/<\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[10086],"tags":[29493,10090,73556],"class_list":["post-1112","post","type-post","status-publish","format-standard","hentry","category-labs","tag-command","tag-mac","tag-script"],"acf":[],"_links":{"self":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts\/1112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/comments?post=1112"}],"version-history":[{"count":1,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts\/1112\/revisions"}],"predecessor-version":[{"id":1113,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts\/1112\/revisions\/1113"}],"wp:attachment":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/media?parent=1112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/categories?post=1112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/tags?post=1112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}