When myscript is executed with the following arguments it fails with error 255 (below)
1 2 3 4 5 6 7
myscript value value /my/path/to/file my_file /tmp/ value value
Checking number of passed arguments
if [ ${#} -ne 7 ]
echo ${#} // Actually prints 7
then
echo "ERROR 255: Must provide the following 7 parameters:
one two three four five six seven"
exit 255
fi
So … If the number is not 7, exit, but do tell what the number is .. 7.
Has the world gone mad? 🙂
Are you sure you don’t have a typo in your question?
Having the
echo ${#}in between theif [ ... ]and thethenis a syntax error, and makes my ksh blow up 😉 Otherwise I think your code looks correct.But why not use newer ksh math evaluation features (maybe this will fix your problem).
I hope this helps.