LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-09-2009, 04:08 AM   #1
icecubeflower
Member
 
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 304

Rep: Reputation: 33
quick shellscript


Anybody know shellscripts?

Suppose this converts an mp3 to a wav:
mpg123 -w song.wav song.mp3

Can anybody write me a little shellscript to convert all mp3's in the same directory as the shellscript to wav's?

I still never learned shellscripts. Probably I should get around to that someday.
 
Old 07-09-2009, 04:14 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
You don't need much scripting for that. I am not familiar with mpg123, but the general idea if you use bash as your shell would be this:

Code:
for file in *.mp3; do lame --decode "$file" "${file/.mp3/.wav}"; done
Change "lame --decode" by whatever you want. I prefer to use lame just because I am familiar with it.
 
Old 07-09-2009, 09:27 AM   #3
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 422

Rep: Reputation: 86
Quote:
Originally Posted by icecubeflower View Post
Anybody know shellscripts?

Suppose this converts an mp3 to a wav:
mpg123 -w song.wav song.mp3

Can anybody write me a little shellscript to convert all mp3's in the same directory as the shellscript to wav's?
or you could also

for file in *.mp3
do
lame --decode "$file" "${file%.*}.wav"
done
 
Old 07-09-2009, 09:43 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by icecubeflower View Post
I still never learned shellscripts. Probably I should get around to that someday.
Indeed!! Eventually you will find that writing your own is more efficient than trying to persuade others to do it for you.

I would start with the "Bash Guide for Beginners" by Machtelt Garrels. Free at http://tldp.org
 
  


Reply


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
Help Shellscript paraiso Linux - Newbie 7 05-12-2005 08:25 AM
Lockscreen Shellscript 2 paraiso Linux - General 1 05-11-2005 06:30 PM
shellScript help paraiso Linux - Newbie 2 05-10-2005 08:09 PM
LS and shellscript - I'm stuck MikeHunt79 Linux - Software 2 03-11-2005 05:44 AM
ShellScript sharadgana Programming 1 12-16-2004 02:16 PM


All times are GMT -5. The time now is 05:55 AM.

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