This is the BASH script:
#!/bin/bash
read -p "Type in a color name, please: " COLOR
case "$COLOR" in
green | red | yellow)
echo -n "nice colors!"
;;
*)
echo -n "meh..."
;;
esac
Once set the x
permission to the script for user, I run it but get the following:
[inewton@centos7 LPIC1-exercises]$ ./colors.sh
Type in a color name, please: pink
./colors.sh: line 12: syntax error near unexpected token `newline'
'/colors.sh: line 12: `esac
[inewton@centos7 LPIC1-exercises]$
What am I doing wrong? Help me please.
echo
lines could have a CR, and other lines could have a space and a CR with the space getting lost in the copying. – Gilles 'SO- stop being evil' May 17 '21 at 11:48dos2unix
handles files that have a mix of DOS and Unix line-endings. – Kusalananda May 17 '21 at 11:50