<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: BASH shell scripting tip: Set default values for variable</title> <atom:link href="http://www.cyberciti.biz/tips/howto-setting-default-values-for-shell-variables.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/howto-setting-default-values-for-shell-variables.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Vivek Gite</title><link>http://www.cyberciti.biz/tips/howto-setting-default-values-for-shell-variables.html#comment-149928</link> <dc:creator>Vivek Gite</dc:creator> <pubDate>Sat, 08 Aug 2009 05:29:15 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-setting-default-values-for-shell-variables.html#comment-149928</guid> <description>See &lt;a href=&quot;http://www.cyberciti.biz/faq/bash-ksh-if-variable-is-not-defined-set-default-variable/&quot; rel=&quot;nofollow&quot;&gt;this FAQ&lt;/a&gt;.</description> <content:encoded><![CDATA[<p>See <a
href="http://www.cyberciti.biz/faq/bash-ksh-if-variable-is-not-defined-set-default-variable/" rel="nofollow">this FAQ</a>.</p> ]]></content:encoded> </item> <item><title>By: 0xception</title><link>http://www.cyberciti.biz/tips/howto-setting-default-values-for-shell-variables.html#comment-149927</link> <dc:creator>0xception</dc:creator> <pubDate>Fri, 07 Aug 2009 23:23:42 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/howto-setting-default-values-for-shell-variables.html#comment-149927</guid> <description>Thanks for the explanation... I&#039;ve been trying to work with some shell scripts which are a bit more advanced then what i&#039;m used to and this helped a lot. I was wondering if you also knew what ${VAR:+xxx} syntax and/or the ${VAR:-xxx} is for?
I&#039;m seeing this in a script which uses
export ${NO_EXPORT:+-n} CONFIG_SECTION=&quot;$name&quot;
is this just a method of applying an conditional flag to a variable inline (like an assert statement)? I&#039;m not sure as if that were true they could just as simply do
[ -n &quot;$NO_EXPORT&quot; ] &amp;&amp; CONFIG_SECTION=&quot;$name&quot;</description> <content:encoded><![CDATA[<p>Thanks for the explanation&#8230; I&#8217;ve been trying to work with some shell scripts which are a bit more advanced then what i&#8217;m used to and this helped a lot. I was wondering if you also knew what ${VAR:+xxx} syntax and/or the ${VAR:-xxx} is for?</p><p>I&#8217;m seeing this in a script which uses<br
/> export ${NO_EXPORT:+-n} CONFIG_SECTION=&#8221;$name&#8221;</p><p>is this just a method of applying an conditional flag to a variable inline (like an assert statement)? I&#8217;m not sure as if that were true they could just as simply do<br
/> [ -n "$NO_EXPORT" ] &amp;&amp; CONFIG_SECTION=&#8221;$name&#8221;</p> ]]></content:encoded> </item> </channel> </rss>
