{"id":515,"date":"2024-11-08T10:00:24","date_gmt":"2024-11-08T10:00:24","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=515"},"modified":"2024-12-12T14:50:30","modified_gmt":"2024-12-12T14:50:30","slug":"mwnci-getpwent-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-getpwent-function\/","title":{"rendered":"Mwnci getpwent() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>getpwent<strong>(<em>[string]<\/em>)<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>getpwent()<\/i> function returns a hash for the given user name or Uid. If no argument is given then an array of hashes of each user entry is returned.<\/p>\n<h2>Example<\/h2>\n<pre>include(\"pwd\")\r\nprintln(getpwent(\"root\"))\r\nprintln(getpwent(0))\r\nprintln(getpwent())\r\n\r\n\r\n{\"Home\": \"\/root\", \"Gecos\": [\"Rooty Root\", \"\", \"\", \"\"], \"User\": \"root\", \"Uid\": 0, \"Shell\": \"\/bin\/bash\", \"Gid\": 0}\r\n{\"User\": \"root\", \"Uid\": 0, \"Gid\": 0, \"Gecos\": [\"Rooty Root\", \"\", \"\", \"\"], \"Home\": \"\/root\", \"Shell\": \"\/bin\/bash\"}\r\n[{\"Gid\": 0, \"Home\": \"\/root\", \"Gecos\": [\"Rooty Root\", \"\", \"\", \"\"], \"User\": \"root\", \"Uid\": 0, \"Shell\": \"\/bin\/bash\"}, {\"Uid\": 1, \"Gecos\": [\"daemon\"], \"Gid\": 1, \"Home\": \"\/usr\/sbin\", \"Shell\": \"\/usr\/sbin\/nologin\", \"User\": \"daemon\"}, {\"Gid\": 2, \"Home\": \"\/bin\", \"Gecos\": [\"bin\"], \"User\": \"bin\", \"Uid\": 2, \"Shell\": \"\/usr\/sbin\/nologin\"}, {\"Gid\": 3, \"User\": \"sys\", \"Gecos\": [\"sys\"], \"Home\": \"\/dev\", \"Shell\": \"\/usr\/sbin\/nologin\", \"Uid\": 3}, {\"User\": \"sync\", \"Gecos\": [\"sync\"], \"Uid\": 4, \"Gid\": 65534, \"Home\": \"\/bin\", \"Shell\": \"\/bin\/sync\"}, {\"Uid\": 5, \"Gid\": 60, \"Shell\": \"\/usr\/sbin\/nologin\", \"Home\": \"\/usr\/games\", \"Gecos\": [\"games\"], \"User\": \"games\"}]\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax getpwent([string]) Description The getpwent() function returns a hash for the given user name or Uid. If no argument is given then an array of hashes of each user entry is returned. Example include(&#8220;pwd&#8221;) println(getpwent(&#8220;root&#8221;)) println(getpwent(0)) println(getpwent()) {&#8220;Home&#8221;: &#8220;\/root&#8221;, &#8220;Gecos&#8221;: [&#8220;Rooty Root&#8221;, &#8220;&#8221;, &#8220;&#8221;, &#8220;&#8221;], &#8220;User&#8221;: &#8220;root&#8221;, &#8220;Uid&#8221;: 0, &#8220;Shell&#8221;: &#8220;\/bin\/bash&#8221;, &#8220;Gid&#8221;: 0} {&#8220;User&#8221;: &#8220;root&#8221;, &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-getpwent-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci getpwent() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-515","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=515"}],"version-history":[{"count":5,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/515\/revisions"}],"predecessor-version":[{"id":903,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/515\/revisions\/903"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}