From neitzel@is.gaertner.de Tue Oct 17 08:39:51 2000 Date: Tue, 17 Oct 2000 00:52:23 +0200 (CEST) From: Martin Neitzel To: jhowland@ariel.cs.trinity.edu Subject: Re: Multi-line explicit definitions under jrun > I noticed recently while doing some CGI scripting in j > that mult-line explict definitions fail to be defined > properly. Hi John, you are correct: jrun scripts may not ("will fail on") contain multi-line definitions. Even more general: jrun won't deal with any ")" terminated ": 0" string constants. This is for some reason, though. At the time "jrun" was conceived, it was deemed useful to allow the direct use of control structures as in the following example: #!/usr/local/bin/jrun say =: [: stdout ,&LF if. 6=9 do. say 'I don''t mind, I don''t mi-i-ind.' else. say 'Things are normal, Jimi Hendrix is not in today.' end. exit 0 This #!jrun script works. It does so because the $JLIB/shell.ijs script will interpolate the script into a verb which it constructs on-the-fly. (Appended below for quick reference.) On the downside, this cannot cope with ")" script stoppers. I now notice that this is not documented in the jrun man page. Perhaps I wasn't aware of that feature myself when I wrote it... Anyway, shame on me, I can imagine that this deviation from the standard script behaviour did cost you (and others?) quite some time. Your two most simple options to get explicit multiline defs running are: - Use the standard setup, break your #!jrun script into two files: a short #!jrun one-liner "load"ing the real thing (no "define" problems there). A no-brainer, but somewhat inelegant. - Modify shell.ijs to have a look at ARGS to control its behaviour. I myself should take of the second approach ASAP but it's unlikely to happen before Thursday. I guess you'll be much quicker on your own ;-) FYI, the J frontend I have in the queue for the next release won't require a separate frontend anymore. Instead, the "j" command will have a lot more options to select between interactive and batch mode (as well as mixes and more flexible profile (non-)loading.) I don't know when Eric Iverson will have settled with his own plans for his frontend code and allow me to put this out, though. His current time schedule appears to be "early 2001". This would then essentially mark the "end of support" date for the current setup for jrun. I hope this helped a little bit, Martin Standard $JLIB/shell.ijs: NB. Set up environment and run a shell script. NB. Useful nouns, defined in z locale: 18!:4 <'z' ARGC=:$ARGV=: 2!:4 '' LF=:NL=: 10{a. JDIR=:1!:42'' SCRIPT=:SCRIPT}.~('#!'-:2{.SCRIPT)*>:0{#;._2 SCRIPT=:1!:1]0{ARGV NB. Useful verbs: exit=: 2!:55 getenv=: 2!:5 echo=: 1!:2&2 stdout=: 1!:2&4 stderr=: 1!:2&5 stdin=: 1!:1 bind 3 :. stdout NB. return to base: 18!:4 <'base' NB. Define script as verb (to allow use of control structures) and run: (0 0$0)[3 : SCRIPT]0 exit 0