{"id":31,"date":"2013-09-09T16:21:02","date_gmt":"2013-09-09T16:21:02","guid":{"rendered":"http:\/\/manatails.net\/blog\/?p=31"},"modified":"2022-04-03T13:48:58","modified_gmt":"2022-04-03T04:48:58","slug":"saving-unix-environment-variables-to-an-executable-script","status":"publish","type":"post","link":"https:\/\/manatails.net\/blog\/2013\/09\/saving-unix-environment-variables-to-an-executable-script\/","title":{"rendered":"Saving UNIX environment variables to an executable script"},"content":{"rendered":"<p>There are times when you want to save environment variables to a script for easy access<\/p>\n<p><a href=\"http:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_03_46.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-33\" src=\"http:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_01_39.png\" alt=\"Screenshot_from_2013-09-09_21_01_39\" width=\"820\" height=\"509\" srcset=\"https:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_01_39.png 820w, https:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_01_39-300x186.png 300w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>But when you actually execute it, you&#8217;ll soon find that the environment variables are kept only while the script is running.<\/p>\n<p><a href=\"http:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_03_46.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-32\" src=\"http:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_03_46.png\" alt=\"Screenshot_from_2013-09-09_21_03_46\" width=\"820\" height=\"509\" srcset=\"https:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_03_46.png 820w, https:\/\/manatails.net\/blog\/wp-content\/uploads\/2014\/08\/Screenshot_from_2013-09-09_21_03_46-300x186.png 300w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Simple solution: add another dot in front of the script command.<br \/>\nThat will stop the environment variable from resetting after the script has finished.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are times when you want to save environment variables to a script for easy access But when you actually execute it, you&#8217;ll soon find that the environment variables are kept only while the script is running. Simple solution: add another dot in front of the script command. That will stop the environment variable from &hellip; <a href=\"https:\/\/manatails.net\/blog\/2013\/09\/saving-unix-environment-variables-to-an-executable-script\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Saving UNIX environment variables to an executable script<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[14,15],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-computer","tag-linux","tag-unix"],"_links":{"self":[{"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":1,"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/posts\/31\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/manatails.net\/blog\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}