msb@lsuc.UUCP (Mark Brader) (02/14/85)
stewart@houxf.UUCP (Bill Stewart HO 4K-435 x0705) writes: > While I normally disparage BASIC along with the rest of you, there are > a few places it's useful. I tend to use it for jobs that take too much > arithmetic for shell, but are too small to bother writing in C > FOR I = 1 TO 43 > PRINT "FOO";I > NEXT I My preference would be: awk </dev/null 'BEGIN { for (i=1; i<=43; ++i) print "foo" i }' Yes, the </dev/null and BEGIN are a bit icky, but you can type the whole thing on the command line, and you have C-ish syntax, and printf if you want it. Mark Brader
mwm@ucbtopaz.CC.Berkeley.ARPA (02/15/85)
In article <401@lsuc.UUCP> msb@lsuc.UUCP (Mark Brader) writes: >stewart@houxf.UUCP (Bill Stewart HO 4K-435 x0705) writes: >> While I normally disparage BASIC along with the rest of you, there are >> a few places it's useful. I tend to use it for jobs that take too much >> arithmetic for shell, but are too small to bother writing in C >> FOR I = 1 TO 43 >> PRINT "FOO";I >> NEXT I > >My preference would be: > awk </dev/null 'BEGIN { > for (i=1; i<=43; ++i) print "foo" i }' >Mark Brader Yikes! What's wrong with a nice, simple: % bc for (i = 0; i <= 43; i++) { "foo"; i} Of course, for something complicated, I'll fire up a lisp, but that's anther language. <mike