# tcsh on-target self-test payload. Prints tagged lines the .test greps out. # Pure csh: foreach loop + accumulator, while loop over a list, list arithmetic, # string compare, integer expression. No external tools. @ sum = 0 foreach n ( 1 2 3 4 5 ) @ sum += $n end echo "R1-sum $sum" set fib = ( 1 1 ) @ i = 2 while ( $i < 15 ) @ j = $i - 1 @ next = $fib[$i] + $fib[$j] set fib = ( $fib $next ) @ i++ end echo "R2-fib15 $fib[15]" set s = "hello" if ( "$s" == "hello" ) echo "R3-streq ok" @ p = 6 * 7 echo "R4-mul $p" echo ALL-TCSH-OK