Results 1 to 4 of 4
I am trying to write a bash script to operate on a list of files obtained from wildcard specified file spec. I envision thart each filename would be processed by ...
- 05-04-2009 #1Just Joined!
- Join Date
- Jun 2005
- Location
- Alstead, NH, USA
- Posts
- 20
Wildcard filename processing in bash script
I am trying to write a bash script to operate on a list of files obtained from wildcard specified file spec. I envision thart each filename would be processed by a 2nd bash script, but with in the same script would be fine. I suspect it is simple and obvious but I have searched documents and while I find plenty of information, processing wildcard file specs has elluded me. As DOS batch command to do this would look like this:
for %%f in (*.wav) do wave2mp3 %%f
Each file name matching *.wav would be given to wave2mp3.bat as a parameter. How would I do this in bash?
- 05-04-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
for f [ in *.wav ] ; do wav2mp3 $f ; done
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-04-2009 #3Just Joined!
- Join Date
- Jun 2005
- Location
- Alstead, NH, USA
- Posts
- 20
Thanks. It worked when I changed it to:
for f in [ *.wav ] ; do wav2mp3 $f ; done
- 05-04-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
As you see, it is very similar to the DOS batch version, just enough different to not work!
. Glad to help. And FWIW, read the bash man pages. Most of this stuff is to be found there.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote