Hello everyone,
i am fairly new to shell scripting so please bear with me.
The following script is supposed to read words from a file and depending on the word print different things.
However it always prints the default value.
It also refuses to work completely if the first line in 'numbers.txt' is not a blank line.
I would be grateful for any hints whatsoever.
script
#!/bin/bash
file="numbers.txt"
while read line
do
operator=`awk '{print $1}' $line`
case $operator in
"divide") echo "/";;
"multiply") echo "x";;
"add") echo "+";;
"subtract") echo "-";;
*) echo "default";;
esac
done < "$file"
numbers.txt (the first line is a blank!)
divide
multiply
add
subtract