{"id":1970,"date":"2021-01-25T10:01:50","date_gmt":"2021-01-25T10:01:50","guid":{"rendered":"https:\/\/swiv.com.br\/how-does-path-variable-work-in-bash\/"},"modified":"2026-05-27T20:02:53","modified_gmt":"2026-05-27T19:02:53","slug":"how-does-path-variable-work-in-bash","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/01\/25\/how-does-path-variable-work-in-bash\/","title":{"rendered":"How does &#8220;PATH&#8221; variable work in bash?"},"content":{"rendered":"\n<p>Os comandos que s\u00e3o executados no Linux, mesmo sendo internos, ou de programas externos, precisam definir o local (diret\u00f3rio) onde est\u00e3o localizados, e essa \u00e9 a fun\u00e7\u00e3o da vari\u00e1vel PATH no Linux. Todos os diret\u00f3rios s\u00e3o separados pelo &#8220;:&#8221; (dois pontos), como no exemplo abaixo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@oel7 bin]# echo $PATH\n\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin\n<\/pre><\/div>\n\n\n<p>Em uma situa\u00e7\u00e3o hipot\u00e9tica, onde dispararmos o comando TAR, o bash precisar\u00e1 validar em todos esses diret\u00f3rios listados em qual deles o programa se encontra.<\/p>\n\n\n\n<p>O PATH existe para localizar os programas externos no Linux.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Os comandos que s\u00e3o executados no Linux, mesmo sendo internos, ou de programas externos, precisam definir o local (diret\u00f3rio) onde est\u00e3o localizados, e essa \u00e9 a fun\u00e7\u00e3o da vari\u00e1vel PATH no Linux. Todos os diret\u00f3rios s\u00e3o separados pelo &#8220;:&#8221; (dois pontos), como no exemplo abaixo: Em uma situa\u00e7\u00e3o hipot\u00e9tica, onde dispararmos o comando TAR, o [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[21],"class_list":["post-1970","post","type-post","status-publish","format-standard","hentry","category-linux","tag-oracle-linux"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/1970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=1970"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/1970\/revisions"}],"predecessor-version":[{"id":9270,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/1970\/revisions\/9270"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=1970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=1970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=1970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}