<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>/sbin/lsmod - Módulos para seu cérebro &#187; shell</title>
	<atom:link href="http://www.lsmod.net/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lsmod.net</link>
	<description></description>
	<lastBuildDate>Mon, 16 Jan 2012 13:12:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using conditional expressions to improve your shell scripts</title>
		<link>http://www.lsmod.net/conditional-expressions-shell-script/</link>
		<comments>http://www.lsmod.net/conditional-expressions-shell-script/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 02:56:51 +0000</pubDate>
		<dc:creator>Jeremias Zerbini</dc:creator>
				<category><![CDATA[Posix]]></category>
		<category><![CDATA[Programação]]></category>
		<category><![CDATA[condicional]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[expressão]]></category>
		<category><![CDATA[expression]]></category>
		<category><![CDATA[expressions]]></category>
		<category><![CDATA[expressões]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[shell script]]></category>

		<guid isPermaLink="false">http://www.lsmod.net/?p=274</guid>
		<description><![CDATA[You can use these very simple shell script conditional expressions to improve your home-made scripts, making them more efficient and easy to mantain. To check if a file exists and it&#8217;s executable, use: There are several other options. Here&#8217;s the full available conditional expressions: -e: Returns true value if file exists -f: Return true value [...]]]></description>
			<content:encoded><![CDATA[<p>You can use these very simple shell script conditional expressions to improve your home-made scripts, making them more efficient and easy to mantain.</p>
<p>To check if a file exists and it&#8217;s executable, use:</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/bash
FILE=/usr/bin/passwd

if [ -x $FILE ];
then
 echo &quot;File $FILE exists and it is executable&quot;
else
 echo &quot;File $FILE does not exists or it isnt executable&quot;
fi</pre>
<p>There are several other options. Here&#8217;s the full available conditional expressions: <span style="color: #ff0000;"><strong></strong></span></p>
<p><span style="color: #ff0000;"><strong>-e</strong></span>: Returns true value if file exists<span style="color: #ff0000;"><strong><br />
-f</strong></span>: Return true value if file exists and regular file<br />
<strong><span style="color: #ff0000;">-r</span></strong>: Return true value if file exists and is readable<br />
<span style="color: #ff0000;"><strong>-w</strong></span>: Return true value if file exists and is writable<br />
<span style="color: #ff0000;"><strong>-x</strong></span>: Return true value if file exists and is executable<br />
<span style="color: #ff0000;"><strong>-d</strong></span>: Return true value if exists and is a directory</p>
<p>Have fun improving your scripts !</p>
<img src="http://www.lsmod.net/?ak_action=api_record_view&id=274&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.lsmod.net/conditional-expressions-shell-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.lsmod.net/tag/shell/feed/ ) in 0.48668 seconds, on Feb 12th, 2012 at 1:55 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 12th, 2012 at 2:55 pm UTC -->
