[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



-----Original Message-----
From: Geoffrey <esoteric at 3times25.net>
Sent: Feb 18, 2005 7:26 AM
To: Atlanta Linux Enthusiasts <ale at ale.org>
Subject: Re: [ale] Bash scripting question #2

Michael Hirsch wrote:
> On Thu, 17 Feb 2005 22:51:51 -0500, Dow Hurst <Dow.Hurst at mindspring.com> wrote:
> 
>>So the || in the do loop says to only execute the echo if the test of
>>the link being a file that exists returns true?
> 
> 
> No, exactly the opposite.  It is a logical "OR", so it only executes
> if the test returns false.  If $fn is not a regular file "test -f $fn"
> is false, so the other half of the OR needs to be tested.
> 
> I've never seen || used the way you use it in your while loop.  I
> don't think it works like that.  You have
> if [ -f $file1 || file2 ] ...
> which means "if file1 is a file or file2".  Note that I didn't write
> "if file1 is a file or file2 is a file".  I don't know what it means
> to test just a filename.  I think you need multiple -f flags like:
> if [ -f $file1 || -f $file2 ] ...

That won't work, that's why I used the '-o' syntax in an earlier post. 
You can do it this way:

if [ -f foo ] || [ -f bar ]....

But that's more typing.. :)

-- 
Until later, Geoffrey
_______________________________________________
Ale mailing list
Ale at ale.org
<a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>


No sig.


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00704.html">[ale] [OT] I just bought an iBook, what now</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00706.html">[ale] Bash scripting question #2</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00708.html">[ale] William Gates -- movie villian</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00706.html">[ale] Bash scripting question #2</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00705"><strong>Date</strong></a></li>
<li><a href="threads.html#00705"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>