let counter=1
You are initializing the variable
counter to 1.
for x in $@
Suppose your input at the prompt is $> sh myscript.sh arg1 arg2 arg3
$@ will take arg1, arg2 and arg3 as a single string i.e. it will hold it as "arg1 arg2 arg3"
for x in $@ means,
for each of the arg in $@ i.e. arg1, arg2, arg3 taken one at a time.
if [[ -f $x ]]
means, test if $x is a file or not.
-f refers to the
True if file exists and is a regular file
$x refers to the individual arg in context, i.e. (in this case) arg1 , arg2..et al.
let counter=$counter+1
You are incrementing the numerical value of counter.
Help yourself to some scripting tutorial at
http://quong.best.vwh.net/shellin20/
That should answer your question.
While on this, a question for others, why do we need
if [[ -f $x ]] instead of
if [ -f $x ]