I am a beginner in shell scripting. I am trying to write a shell script which reads a file and prints out the lines in the file that starts with and ends with a certain word - say "Hi" in my case.. So I wrote he script to find the lines which starts with "Hi" , but got an error..Any help what is the problem?
f="\bkg\inp.txt"
while IFS='' read -r line || [[ -n "$line" ]]; do
if [[ $line=="Hi*"]]; then
printf '%s\n' "$line"
fi
done < "$f"
The error says:
$ sh script.sh
script.sh: line 5: unexpected token `;', conditional binary operator expected
script.sh: line 5: syntax error near `;'
script.sh: line 5: ` if [[ $line=="Hi*"]]; then'
Any help is very much appreciated ..