Hi there! I just started learning and writing shell scripts and have decided to practice the basics of file handling, script control and user input.
I use a command line music player called xmms2 (now updated to nyxmms2)
and decided to shorten the commands.
as you can see I have written a function (I intend to have all of the case statement options as functions)
Is there a better way to pass the value of $2 to the function?
any other criticism welcome

thanks in advance.
Code:
#!/bin/bash
# *******smegy********* copy of smeg for testing new things
# smeg - small media entertainment gizzmo
# this shell script controls the nyxmms2 music player with simpler
# commands
function jumpTo {
nyxmms2 jump "$patern"
}
# if the varible $1 contains input then procede through the case statement
# checking for commands
if [ -n "$1" ]
then
case "$1" in
jumpit) patern="$2"; jumpTo ;;
on) nyxmms2 next;;
# play next tune
back) nyxmms2 prev;;
# go back one tune
list) nyxmms2 list;;
# list the current playlist
off) nyxmms2 server shutdown;;
# shut down nyxmms2 removing it from processes
add) nyxmms2 add -t artist:"$2";;
# append an artist to the current playlist
showlists) nyxmms2 collection list;;
# show all playlists avialable
mplist) xmms2 collection create "$2" artist:"$3";;
# make and name a new playlist
search) xmms2 search artist:"$2";;
# search for artist list, useful to do before adding and
# naming a new playlist
*) nyxmms2 stop; nyxmms2 playlist clear; nyxmms2 add in:"$1"; nyxmms2 play;;
# if not a command add artist playlist to the playlist
esac
# if $1 does not contain input then simply toggle play/pause
# when paused xymms2 is running in the background, to terminate it
# use smeg off
else nyxmms2 toggle
fi