Hi guys,
I just want to confirm whether OS X 10.9.3 really is a bit of a pigs breakfast.
I have the following code (Korn shell)
typeset -i j=0
#
while (( j <= count ))
do
printf "-- j = %d\n" $j
if [ ${arrayA[j]} == $search_value ]
then
answer=$(( $j + 1 ))
# answer=$j
printf "answer = %d\n" $answer
# exit 0
fi
(( j = j + 1 ))
done
#
I'm getting the following error: (the loop has 28 entries).
answer = 28
/Users/simoningram/unix/bin/linear_search_old.ksh[63]:
printf: -- j: unknown option
Usage: printf [ options ] format [
string ...]
/Users/simoningram/unix/bin/linear_search_old.ksh[64]: [: argument expected
29
answer = 28
I am concerned about the "printf unknown option" error, since IMHO there is nothing wrong with the syntax (the second printf is ok)
This just shows details about the installation:
/Users/simoningram/unix/bin => uname -a
Darwin Simons-iMac.local 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64
I have seen posts about printf not working with find, but this is just the standard shell command.
I'm going a bit blind on this one. Am I missing something?