Creating switches in a bash script
Hello,
I am very new to writing scripts and am just trying to learn the basics. What I have done is created the following script:
filename=${1:?"filename missing."}
howmany=$2
echo ${album_line:9}
echo ${album_line:0:8}
echo -e -n ${header:+"ALBUMS ARTIST\n"}
sort -nr $1 | head -${howmany:=10}
and what I am trying to do is make it if you use -h, it will show the header when ran and if you don't use -h it will run normally. Also, I am trying to make it so I can use two other switches to just list one or the other column. I know it is probaly a stupid question but I am just trying to get my feet wet.
Thanks for the help,
Jon
|