Anyone have an alternate way to parse an environment variable?

I have a filename in an environment variable that I'd like to parse.   
The filename is of the form "foo.bar.txt" and I'd like to parse out  
"bar".  This is the solution I'm currently using:

file=foo.bar.txt
file=${file%.txt}
file=${file#foo.}

Any other solutions?

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

 
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/

Reply via email to