<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Knowledge Base (Posts about theory)</title><link>https://bgstack15.ddns.net/blog/</link><description></description><atom:link href="https://bgstack15.ddns.net/blog/categories/theory.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2022 &lt;a href="mailto:bgstack15@gmail.com"&gt;bgstack15&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-SA"
style="border-width:0; margin-bottom:12px;"
src="https://bgstack15.ddns.net/.images/l_by-sa_4.0_88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Sun, 27 Feb 2022 04:04:51 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Global variables everyone should use</title><link>https://bgstack15.ddns.net/blog/posts/2020/04/03/global-variables-everyone-should-use/</link><dc:creator>bgstack15</dc:creator><description>&lt;p&gt;This is a post about theory. When writing a small program, or any sized
program really, you should consider using some global environment variables.
These can really help you out, and could prevent you from shutting your
computer down (if you happen to be writing a tool that shuts your computer
down)! Set &lt;strong&gt;DRYRUN&lt;/strong&gt; to any non-null value to have your script/program only
display what it will do or otherwise take no action. This is incredibly
important for early-phase testing! You want to make sure your branching works
and you get to each intended action, without actually rebooting perhaps. Set
&lt;strong&gt;VERBOSE&lt;/strong&gt; to any non-null value to display what it is doing. This could be
as verbose as "&lt;a href="https://stackoverflow.com/questions/36273665/what-does-set-x-do/36273740#36273740"&gt;set -x&lt;/a&gt;" or, for example, echo "about to fraternize
with the enemy..." before pinging a remote host. Set &lt;strong&gt;DEBUG&lt;/strong&gt; or
&lt;strong&gt;DEBUG_LEVEL&lt;/strong&gt; to an integer from 0 to 10 to decide how much verbosity you
want. Output should generally go to standard error. And now you can have a
conditional for your verbose messages, so DEBUG=1 gets the most basic
messages, but DEBUG=10 gets "set -x" or some other scale of your choice. I
normally use DEBUG=8 as a threshold for displaying sensitive information.
Passwords will be masked up to level 8, but at level 8 and above, even
password variables might leak.&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;echo "This message goes to standard error" 1&amp;gt;&amp;amp;2
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;What sorts of global variables do you tend to use in your programming that
others should use?&lt;/p&gt;</description><category>theory</category><guid>https://bgstack15.ddns.net/blog/posts/2020/04/03/global-variables-everyone-should-use/</guid><pubDate>Fri, 03 Apr 2020 12:58:40 GMT</pubDate></item></channel></rss>