bash if file exists

David Rosenstrauch darose at darose.net
Sun Apr 6 01:58:03 EDT 2008


Matt Brodeur wrote:
> On Fri, Apr 04, 2008 at 09:33:58PM -0400, David Rosenstrauch wrote:
>> What about the curly braces though?  Never seen that before either.
> 
> That's just habit, mostly.  See "Brace Expansion" in bash(1) for all
> the fun things you can do inside curly braces.  In this case it wasn't
> necessary, but I do it for consistency.  It's useful when you need to
> embed a variable in a string, such as:


Tnx much for pointing me to the right "M" in RTFM!  :-)  In all 
seriousness, much appreciated - I'm always interested to learn something 
that'll make me code better.


> for x in 1 2 3 ; do echo "${x}blah" ; done
> 
> Without the braces you get three blank lines.  With the braces you get
> the expected output.

Boy, dem bash some wacky stuff, sometimes!!!  :-)

Tnx again,

DR

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Discuss mailing list