notes/Get Song Lyrics BASH Shell Script-Sp2LFctb.sh
#!/bin/bash
domain="http://www.mldb.org"
search="$domain/search?mq="
#color settings
bold=`echo -en "\e[1m"`
underline=`echo -en "\e[4m"`
red=`echo -en "\e[31m"`
aqua=`echo -en "\e[36m"`
default=`echo -en "\e[39m"`
RED=`echo -en "\e[41m"`
AQUA=`echo -en "\e[46m"`
DEFAULT=`echo -en "\e[49m"`
if [ "$1" == "" ]
then
echo -n "${RED}Artist:${DEFAULT} "
read artist
else
artist="$1"
fi
wget -q "${search}${artist}" -O-|sed 's/<a/\n<a/g'|grep 'href="song'|while read line
do
song="$(echo "$line"|cut -d\> -f2|cut -d\< -f1 )"
link="$(echo "$line"|cut -d\" -f2 )"
echo "$song|$domain/$link"
done > /tmp/lyrics.lst
mapfile -t list < /tmp/lyrics.lst
let x=0
cat /tmp/lyrics.lst|while read line
do
echo "$x - $(echo "$line"|cut -d\| -f1)"
let x++
done
echo -n "${red}Select a Song#: ${default}"
read n
echo "Getting Lyrics for $(echo ${list[$n]}|cut -d\| -f1)"
wget -q -O- "$(echo ${list[$n]}|cut -d\| -f2)"|\
awk '/songtext/,/script/ { print }' |\
sed 's|</b>|-|g' |\
sed 's|<[^>]*>||g'|\
less
echo "Goodbye..."
syntax highlighted by Code2HTML, v. 0.9.1