Register
It is currently Mon Apr 21, 2014 9:28 am

i have a stupid problem..but i can't find


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed Feb 01, 2012 11:54 am   

Joined: Wed Feb 01, 2012 11:50 am
Posts: 1
#!/bin/bash
abspath=$(cd ${0%/*} && echo $PWD/${0##*/})
echo $abspath
# to get the path only
path_only=`dirname "$abspath"`
i=0
#cd $(dirname $0)
echo "Auto Playlist Generator (main.lst)"
echo " Run program in mp3 directory"
echo " Start Program...."
#FILES=$path_only/*

if [ -z $1 ]; then

cd $(dirname $0)
FILES=$path_only/*
#echo $FILES

for f in *.mp3

do
echo " "
echo "Run..Processing '$f' file..."
echo "Inserimento File '$f' directory '$path_only' nel file main.lst"
echo "$path_only/$f" >> "main.lst"
echo "OK"
echo " "
let "i += 1"


done


else

cd $(dirname $1)

FILES=$1"/*"
#echo $FILES
for f in "*.mp3"
do

echo " "
echo "Run..Processing '$f' file..."
echo "Inserimento File '$f' directory '$1' nel file main.lst"
echo "$1/$f" >> "main.lst"
echo "OK"
echo " "
let "i += 1"

done
fi



echo "Processati '$i' file mp3 nel file main.lst"
echo " "
echo "Exit Program"
echo " "


...this is output program


demons@demons-virtual-machine:~/bashs$ ./autopl.sh.save /home/demons/bash2
/home/demons/bashs/autopl.sh.save
Auto Playlist Generator (main.lst)
Run program in mp3 directory
Start Program....
/home/demons/bash2/lillo2.mp3 /home/demons/bash2/pippo2.mp3

Run..Processing '*.mp3' file...
Inserimento File '*.mp3' directory '/home/demons/bash2' nel file main.lst
OK

Processati '1' file mp3 nel file main.lst


not work......program write file in directory but for don't work...

but run withoth $1 work ok


demons@demons-virtual-machine:~/bashs$ ./autopl.sh.save
/home/demons/bashs/autopl.sh.save
Auto Playlist Generator (main.lst)
Run program in mp3 directory
Start Program....

Run..Processing 'lillo3.mp3' file...
Inserimento File 'lillo3.mp3' directory '/home/demons/bashs' nel file main.lst
OK


Run..Processing 'pippo.mp3' file...
Inserimento File 'pippo.mp3' directory '/home/demons/bashs' nel file main.lst
OK

Processati '2' file mp3 nel file main.lst

Exit Program


help meeeeee =)


Top
 Profile  
 PostPosted: Sat Feb 04, 2012 8:49 am   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
Didn't read everything, but I can tell that in the second for there are quotes around « *.mp3 », so the glob doesn't match any file.

Code:
for f in "*.mp3"


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP