<?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 posix)</title><link>https://bgstack15.ddns.net/blog/</link><description></description><atom:link href="https://bgstack15.ddns.net/blog/categories/posix.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>Tue, 04 Oct 2022 12:45:31 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Check set -x in dash</title><link>https://bgstack15.ddns.net/blog/posts/2022/10/04/check-set-x-in-dash/</link><dc:creator>bgstack15</dc:creator><description>&lt;p&gt;This works in dash, and bash in sh-compliant mode.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;is_x_set="$( set -o | awk '/xtrace/{if($2=="on")print "Y"}' )"
sh &lt;span class="cp"&gt;${&lt;/span&gt;&lt;span class="n"&gt;is_x_set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;+-&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="cp"&gt;}&lt;/span&gt;/path/to/subscript.sh
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This example here shows how to run a subscript with "set -x" if the parent script was called with that, or if it is currently set at this point in the parent script.&lt;/p&gt;</description><category>dash</category><category>posix</category><category>shell</category><guid>https://bgstack15.ddns.net/blog/posts/2022/10/04/check-set-x-in-dash/</guid><pubDate>Tue, 04 Oct 2022 12:39:44 GMT</pubDate></item></channel></rss>