<?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: Understanding &#038; Learning Basic Shell Scripting and Linux Filesystem Troubleshooting &#8211; Part 10	</title>
	<atom:link href="https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/</link>
	<description>Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks.</description>
	<lastBuildDate>Sat, 27 Sep 2025 06:02:08 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Gabriel A. Cánepa		</title>
		<link>https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-784279</link>

		<dc:creator><![CDATA[Gabriel A. Cánepa]]></dc:creator>
		<pubDate>Thu, 26 May 2016 12:27:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=9694#comment-784279</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-784059&quot;&gt;BV Naagabaabu&lt;/a&gt;.

I&#039;m glad to hear that you were able to solve your issue. And thanks for sharing your solution with us!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-784059">BV Naagabaabu</a>.</p>
<p>I&#8217;m glad to hear that you were able to solve your issue. And thanks for sharing your solution with us!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: BV Naagabaabu		</title>
		<link>https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-784059</link>

		<dc:creator><![CDATA[BV Naagabaabu]]></dc:creator>
		<pubDate>Wed, 25 May 2016 15:36:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=9694#comment-784059</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783597&quot;&gt;Gabriel Cánepa&lt;/a&gt;.

hi Gabriel.,
thanks for the suggestion. after some search I came to know that we can&#039;t use wild cards in if conditions to check similar files existence. 
I got an alternate solution using ls command. below is how it works

ls -l /home/user/file_*
res=$?

if [ $res =0 ]
then
     echo &quot;all files exists&quot;
else
     echo &quot;all files not exists&quot;
fi]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783597">Gabriel Cánepa</a>.</p>
<p>hi Gabriel.,<br />
thanks for the suggestion. after some search I came to know that we can&#8217;t use wild cards in if conditions to check similar files existence.<br />
I got an alternate solution using ls command. below is how it works</p>
<p>ls -l /home/user/file_*<br />
res=$?</p>
<p>if [ $res =0 ]<br />
then<br />
     echo &#8220;all files exists&#8221;<br />
else<br />
     echo &#8220;all files not exists&#8221;<br />
fi</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Gabriel A. Cánepa		</title>
		<link>https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783660</link>

		<dc:creator><![CDATA[Gabriel A. Cánepa]]></dc:creator>
		<pubDate>Mon, 23 May 2016 16:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=9694#comment-783660</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783647&quot;&gt;BV Naagabaabu&lt;/a&gt;.

Please check the accepted answer in this Stackoverflow post: http://stackoverflow.com/questions/19354024/using-wildcards-in-bash-if-statement and let me know if it solves your issue.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783647">BV Naagabaabu</a>.</p>
<p>Please check the accepted answer in this Stackoverflow post: <a target="_blank" href="http://stackoverflow.com/questions/19354024/using-wildcards-in-bash-if-statement" rel="nofollow ugc">http://stackoverflow.com/questions/19354024/using-wildcards-in-bash-if-statement</a> and let me know if it solves your issue.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: BV Naagabaabu		</title>
		<link>https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783647</link>

		<dc:creator><![CDATA[BV Naagabaabu]]></dc:creator>
		<pubDate>Mon, 23 May 2016 16:06:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=9694#comment-783647</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783634&quot;&gt;BV Naagabaabu&lt;/a&gt;.

Hi Gabriel.,

Tested this and came to know that the problem is not with if condition, it is with wild cards., Below is my scenario

i have 3 files and one directory. Those 3 files are named as file_name1, file_name2, file_name3 and the directory name is logs.

for checking those 3 files and directory existence, i write a if condition like below.

if [[  -f  /home/user/file_*   &#038;&#038;  -d  /home/user/logs  ]]

while executing the above, IF condition is break at first condition, because it doesn&#039;t find the file &quot;/home/user/file_*&quot;.

How can i use a wild card in if condition]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783634">BV Naagabaabu</a>.</p>
<p>Hi Gabriel.,</p>
<p>Tested this and came to know that the problem is not with if condition, it is with wild cards., Below is my scenario</p>
<p>i have 3 files and one directory. Those 3 files are named as file_name1, file_name2, file_name3 and the directory name is logs.</p>
<p>for checking those 3 files and directory existence, i write a if condition like below.</p>
<p>if [[  -f  /home/user/file_*   &amp;&amp;  -d  /home/user/logs  ]]</p>
<p>while executing the above, IF condition is break at first condition, because it doesn&#8217;t find the file &#8220;/home/user/file_*&#8221;.</p>
<p>How can i use a wild card in if condition</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: BV Naagabaabu		</title>
		<link>https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783634</link>

		<dc:creator><![CDATA[BV Naagabaabu]]></dc:creator>
		<pubDate>Mon, 23 May 2016 14:41:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=9694#comment-783634</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783597&quot;&gt;Gabriel Cánepa&lt;/a&gt;.

hi Gabriel,
Thanks for the quick reply. coming to my scenario.,

i,&#039;m using BASH shell. In a shell script I need to check the file and directory exists or not. if both are available then they should be deleted. 

while using the above if condition(I mentioned) my script was stopped after checking first condition(here file existence) in if condion. while debugging (with set -x)  i got to know that it was not checking the directory existence. 

I will apply your fix and post my output.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-troubleshooting/comment-page-1/#comment-783597">Gabriel Cánepa</a>.</p>
<p>hi Gabriel,<br />
Thanks for the quick reply. coming to my scenario.,</p>
<p>i,&#8217;m using BASH shell. In a shell script I need to check the file and directory exists or not. if both are available then they should be deleted. </p>
<p>while using the above if condition(I mentioned) my script was stopped after checking first condition(here file existence) in if condion. while debugging (with set -x)  i got to know that it was not checking the directory existence. </p>
<p>I will apply your fix and post my output.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
