LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-25-2006, 02:20 PM   #1
Mithrilhall
Member
 
Registered: Feb 2002
Location: Massachusetts
Distribution: Debian (Lenny)
Posts: 286

Rep: Reputation: 30
shell script


I found this script online and I'm having some issues with it.
The problem appears to be on line 2 "outputfile='echo $3 | sed s/\.wav$/\.mp3/'".

I'm not fammiliar with shell scripts as you can tell.

Code:
#!/bin/bash 
outputfile=`echo $3 | sed s/\.wav$/\.mp3/`
/usr/local/bin/soxmix $1 $2 $outputfile
rm $1 $2
 
Old 05-25-2006, 02:27 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
how about you start by telling us what the error is and an example use of your script...
 
Old 05-25-2006, 02:37 PM   #3
Mithrilhall
Member
 
Registered: Feb 2002
Location: Massachusetts
Distribution: Debian (Lenny)
Posts: 286

Original Poster
Rep: Reputation: 30
./soxmixmp3.sh: line 3: /var/spool/asterisk/monitor/: is a directory


I'm trying to take all of the wav files in the directory and convert them to mp3 files.
 
Old 05-25-2006, 05:02 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
so, you think the error is on line 2 when the error message states it's on line 3? clearly you're giving sox the wrong data to process... it doesn't want a directory as whatever argument you are giving that as. i'd suggest you read up on sox before trying to use it.
 
Old 05-26-2006, 08:25 AM   #5
Mithrilhall
Member
 
Registered: Feb 2002
Location: Massachusetts
Distribution: Debian (Lenny)
Posts: 286

Original Poster
Rep: Reputation: 30
I think I see what I'm doing wrong here. I'm not passing it any arguments.

Is there any way to alter this script so I can just run it from a command line and convert all the wav files in a directory to mp3's?
 
Old 05-26-2006, 09:35 AM   #6
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
My scripting is rubbish but...

$1, $2 and $3 are to be your inputs, thse are variables interpreted from user input in the shell, so you'd run something like

Code:
soxmixmp3.sh <wav_file> <second_wav_file??) <mp3_file>
And it should convert the wavs to the MP3..

Try it but BACK UP THE WAVs!!!! The last line of the script tells it to remove the wavs when done.
 
Old 05-26-2006, 03:46 PM   #7
Mithrilhall
Member
 
Registered: Feb 2002
Location: Massachusetts
Distribution: Debian (Lenny)
Posts: 286

Original Poster
Rep: Reputation: 30
Well I found out what the problem was.

I had a single quote where it should have been the character on the tilde key.
 
  


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
Shell script inside shell script treotan Linux - General 4 02-19-2009 07:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 03:14 AM
I made a shortcut to a shell script and it is using default shell icon... shlinux Linux - Software 2 04-20-2006 07:29 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 03:34 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 06:32 PM


All times are GMT -5. The time now is 04:47 PM.

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