[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4668: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4670: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4671: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4672: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
Void's Forums • View topic - Basic Bash Scripting Question

Basic Bash Scripting Question

Discuss Programming

Postby Calum » Fri May 16, 2003 8:59 am

User avatar
Calum
guru
guru
 
Posts: 1348
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland

Postby Nobber » Fri May 16, 2003 9:13 am

Nobber
user
user
 
Posts: 32
Joined: Thu Jan 23, 2003 8:36 am
Location: Slackville

Postby Void Main » Fri May 16, 2003 5:20 pm

User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Calum » Sat May 17, 2003 3:20 am

User avatar
Calum
guru
guru
 
Posts: 1348
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland

Postby Void Main » Sat May 17, 2003 7:16 am

User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby falosa » Sat Oct 09, 2004 11:18 am

Hi,
This script still does not work for me if I use filenames with spaces or wildcards. does it happens only to me? I have modified it to accept those parameters. I have also modified the help at the beginning because, for example, wildcards does not need double quotes now.


#!/bin/bash
#############################################################
# wma2mp3 v0.2
# by Calum and Void Main
# modified by falosa
#
# e.g. wma2mp3 myfile.wma
# e.g. wma2mp3 myfile.wma myfile2.wma myfile3.wma
# e.g. wma2mp3 "my file.wma" "my file 2.wma" "my file 3.wma"
# e.g. wma2mp3 my\ file.wma my\ file\ 2.wma my\ file\ 3.wma
# e.g. wma2mp3 *.wma
# e.g. wma2mp3 /directory/containing/wma/files
# e.g. wma2mp3 .
#
# viewtopic.php?t=407
#
# History:
# 16 May 2003 - v0.1 wma2mp3 script created
#############################################################

#############################################################
# Move the conversion process into a function that can
# be called.
# The "&&" makes it so each step must be successful before
# the next step will be done.
#############################################################
function wma2mp3 () {
if [ ! -f "$1" ]; then
echo "File $1 not found!"
else
mplayer -ao pcm -aofile "${1%%.[Ww][Mm][Aa]}.wav" "$1" &&
lame -h -b 192 "${1%%.[Ww][Mm][Aa]}.wav" "${1%%.[Ww][Mm][Aa]}.mp3" &&
rm -f "${1%%.[Ww][Mm][Aa]}.wav" ||
echo "There was a problem with the conversion process!"
fi
}

#############################################################
# Not enough information to compute
#############################################################
if [ $# -lt 1 ]; then
echo "Syntax: `basename $0` <wmaFilename(s)|wmaDirectory>"
exit
fi

#############################################################
# Directory was passed so convert all wma files in directory
#############################################################
if [ $# -eq 1 -a -d "$1" ]; then
for file in $1/*.[Ww][Mm][Aa]
do
wma2mp3 "$file"
done
exit
fi

#############################################################
# One or more wma files were passed, convert them
#############################################################
while [ 1 -le $# ]
do
wma2mp3 "$1"
shift
done
exit
falosa
n00b
n00b
 
Posts: 1
Joined: Sat Oct 09, 2004 11:05 am

Postby Calum » Sun Aug 28, 2005 4:19 pm

User avatar
Calum
guru
guru
 
Posts: 1348
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland

Postby Void Main » Sun Aug 28, 2005 5:14 pm

User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Calum » Sun Nov 13, 2005 10:43 am

User avatar
Calum
guru
guru
 
Posts: 1348
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland

Postby Calum » Mon Dec 19, 2005 2:23 pm

Last edited by Calum on Mon Dec 19, 2005 3:06 pm, edited 1 time in total.
User avatar
Calum
guru
guru
 
Posts: 1348
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland

Postby Void Main » Mon Dec 19, 2005 2:44 pm

User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby ZiaTioN » Mon Dec 19, 2005 3:37 pm

ZiaTioN
administrator
administrator
 
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm

Postby Void Main » Mon Dec 19, 2005 3:41 pm

User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby worker201 » Mon Dec 19, 2005 4:01 pm

worker201
guru
guru
 
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Postby Calum » Mon Dec 19, 2005 6:20 pm

User avatar
Calum
guru
guru
 
Posts: 1348
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland

PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron