
{"id":16420,"date":"2016-01-26T19:00:48","date_gmt":"2016-01-26T19:00:48","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=16420"},"modified":"2016-01-26T19:00:48","modified_gmt":"2016-01-26T19:00:48","slug":"sample-session-involving-env-and-unset-commands","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2016\/01\/26\/sample-session-involving-env-and-unset-commands\/","title":{"rendered":"sample session involving &#8220;env&#8221; and &#8220;unset&#8221; commands"},"content":{"rendered":"<p><u>ABOUT env<\/u><\/p>\n<pre>\nenv is a shell command for Unix and Unix-like operating systems. It is used to either print a list of environment variables or run another utility in an altered environment without having to modify the currently existing environment. Using env, variables may be added or removed, and existing variables may be changed by assigning new values to them.\n\nIn practice, env has another common use. It is often used by shell scripts to launch the correct interpreter. In this usage, the environment is typically not changed.\n<\/pre>\n<p><u>ABOUT unset<\/u><\/p>\n<pre>\nunset is a builtin command implemented by both the Bourne shell family (sh, ksh, bash, etc.) and the C shell family (csh, tcsh, etc.) of Unix command line shells. It unsets a shell variable, removing it from memory and the shell's exported environment. It is implemented as a shell builtin, because it directly manipulates the internals of the shell.[2][3]\n\nRead-only shell variables cannot be unset. If one tries to unset a read-only variable, the unset command will print an error message and return a non-zero exit code.\n<\/pre>\n<p><u>A TYPICAL SHELL SESSION<\/u><br \/>\n[bash]<br \/>\n$ls -l<br \/>\ntotal 0<br \/>\n-rw-r&#8211;r&#8211; 1 jeffrin jeffrin 0 Jan 27 00:13 hello<br \/>\n-rw-r&#8211;r&#8211; 1 jeffrin jeffrin 0 Jan 27 00:14 world<br \/>\n$pwd<br \/>\n\/home\/jeffrin\/sample<br \/>\n$env -i HOME=\/home\/jeffrin `cd`<br \/>\nHOME=\/home\/jeffrin<br \/>\n$pwd<br \/>\n\/home\/jeffrin\/sample<br \/>\n$ls<br \/>\nhello  world<br \/>\n$env -i bash<br \/>\njeffrin@debian:\/home\/jeffrin\/sample$ echo $TERM<br \/>\ndumb<br \/>\njeffrin@debian:\/home\/jeffrin\/sample$ echo $PS1<br \/>\n${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$<br \/>\njeffrin@debian:\/home\/jeffrin\/sample$ export PS1=&gt;<br \/>\nbash: syntax error near unexpected token `newline&#8217;<br \/>\njeffrin@debian:\/home\/jeffrin\/sample$ export PS1=&quot;&gt;&quot;<br \/>\n&gt;unset $PS1<br \/>\nbash: unset: `&gt;&#8217;: not a valid identifier<br \/>\n&gt;unset PS1<br \/>\nexport PS1=$<br \/>\n$<br \/>\n[\/bash]<br \/>\nLINKS<br \/>\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/Env\">https:\/\/en.wikipedia.org\/wiki\/Env<\/a><br \/>\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/Environment_variable#unset_command\">https:\/\/en.wikipedia.org\/wiki\/Environment_variable#unset_command<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ABOUT env env is a shell command for Unix and Unix-like operating systems. It is used to either print a list of environment variables or run another utility in an altered environment without having to modify the currently existing environment. Using env, variables may be added or removed, and existing variables may be changed by &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2016\/01\/26\/sample-session-involving-env-and-unset-commands\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;sample session involving &#8220;env&#8221; and &#8220;unset&#8221; commands&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[721,1626],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16420"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=16420"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16420\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=16420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=16420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=16420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}