I'm stuck in a surely simple question (absolutely sure I'll feel a dummy when a solution comes up). I need to read a string in a bash script and proceed depending on the string value. This piece of code it is not working by now
k=`awk '{ print $1 }' flag.txt`
echo "FLAG = "$k
case "$k" in
"S") echo " Yes it worked - Flag = " $k ;;
"N") echo " NOOOOOOOOOOOO - Flag = " $k ;;
*) echo "Not getting the right string??" ;;
esac
The string value is right as echo command shows the right value, flag.txt just contains "S" or "N" (N in this case). Absolutely stuck here, can't figure out what's wrong, awk or case. Working in Ubuntu 12.04
Script output:
paco@NIMBUS:~/temp$ cat flag.txt
S
paco@NIMBUS:~/temp$ ./prova2
FLAG = S
Not getting the right string??
Thanks in advance for your help and sorry if it is a silly question.