Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-29-2009, 02:01 PM   #1
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 313

Rep: Reputation: 34
writing a shell script

I don't know much about shell scripts.

Suppose I'm in a directory with 20 .mid files.

Now suppose to change a .mid file to a .wav file I do this:

timidity -Ow -s 44100 -o output.wav input.mid

What is the shellscript to do that to all 20 .mid files and make all the filenames the same except for the extension?
Old 03-29-2009, 02:16 PM   #2
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57

for i in *.mid
timidity -Ow -s 44100 -o "${i%.mid}.wav" "$i"

The above script will keep the same filename as the mid file, only the extension will change.

Last edited by dv502; 03-29-2009 at 02:37 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Writing a shell script mattz40 Debian 5 04-13-2005 07:56 PM
writing a shell script tchoua Linux - General 8 02-24-2005 07:18 PM
shell script writing ust Linux - General 6 01-24-2005 02:06 PM
writing my first shell script speedhead34 Linux - Newbie 4 12-20-2004 01:50 AM
Need Help in Writing a Shell Script. KptnKrill Linux - General 2 05-19-2003 06:44 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration