Article 5FX3E Bash Syntax

Bash Syntax

by
TBotNik
from LinuxQuestions.org on (#5FX3E)
All,

Quick Q:

Have this code reading file listings from a source file:

Code:i=0;
while read -r file; do
nfil=${file:7} # Eliminate 1st 7 chars "file://"
if {grep -i '/etc/' <<< $nfil} then; continue; fi
array[ $i ]="${nfil}"
(( i++ ))
echo "N=> $i F=> $nfil"
done < "${src_fil}"The "grep" line is to eliminate any "/etc/" files from processing.

Always getting these 2 error lines but no HOWTO explains these errors:

Code:script.sh: line 34: syntax error near unexpected token `fi'
script.sh: line 34: ` if grep -i '/etc/' <<< $nfil then; continue; fi'So why does it think the "fi" which is mandatory, unexpected?

Do you know why or is it actually something else, which BASH lies about constantly?

Cheers!

TBNKlatest?d=yIl2AUoC8zA latest?i=7UkAqDyNZM8:x8Whlk9jJgg:F7zBnMy latest?i=7UkAqDyNZM8:x8Whlk9jJgg:V_sGLiP latest?d=qj6IDK7rITs latest?i=7UkAqDyNZM8:x8Whlk9jJgg:gIN9vFw7UkAqDyNZM8
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments