Could someone please point out why this bash script fails in the if-fi section? I must be getting thick in the head.
#!/bin/bash
echo -e “Is the album you want to play listed here (y/n)?”
read -s -n1 -p “Hit a key " keypress
echo; echo “Keypress was “”$keypress””."
if $keypress=“y” ]; then
echo -e "RESULT YES "
read word
fi
echo -e "RESULT NO "
read word
cd $word*
ls
Pressing “y”…
Is the album you want to play listed here (y/n)?
Hit a key
Keypress was “y”.
RESULT YES
Pressing “n”…
Is the album you want to play listed here (y/n)?
Hit a key
Keypress was “n”.
RESULT YES