Friday, December 24, 2010

Part 2 Lesson 2

Ok so let's create a playlist with a given format(if given). (continue from lesson 1)
User should provide 2 arguments now. The first is the artist and the second the format of the song:
e.g user will give Dion mp3
so $1 is "Dion"
$2 is "mp3"
The script will be like that:

for music in "$1/*/*.$2"; do
audacious -e "$music" &

but what if he misses one argument or he doesn't want to provide one of the 2?
Think about it.
We can ask for an argument -a for the artist and -f for format. eg:
user will give: script_name -a Dion -f wma
-f mp3
or nothing.
Solution on next lesson :P

No comments:

Post a Comment