[Jprogramming] Example bash shell scripts using J 7.01
Eric Iverson
eric.b.iverson at gmail.com
Fri Sep 30 07:36:39 HKT 2011
The fact that #! line is executed by J and depends on it being innocuous has
always been unfortunate. Something I intend to fix eventually. Meanwhile
things like - that that cause execution failures must be avoided in the path
used in #! scripts.
On Thu, Sep 29, 2011 at 7:02 PM, bill lam <bbill.lam at gmail.com> wrote:
> jb is a symlink to the actual jconsole. I use ja for j602 while jb for
> j701.
> Linux kernel has no problem if the shebang line was
>
> #!/usr/local/j64-701/bin/jconsole
>
> But J interpreter knows nothing about the special meaning of #! and it will
> try to
> execute the whole line as if it is a normal J sentence and will raise error
>
> try type these sentence in jconsole session.
>
> #!/foo/bar/bla
> #!/foo/bar/bla+bla
> #!/foo/bar/bla-64
>
> Чтв, 29 Сен 2011, David Ward Lambert писал(а):
> > Response to John Baker's request for unix shell script
> > Message-ID:
> > <CABc=tNyZuqgGK4tL0aRAXRkb7=OzdDFO9PYFoL2p+ZuAAu4a5w at mail.gmail.com>
> > and a follow on to bill lam's message
> > Message-ID: <20110929150714.GA2845 at debian.b2j>
> >
> > I do not know what Bill's jb program is and have been unable to
> > execute j scripts that start with #! /path/jconsole
> > Instead I use a bigger hammer: exec
> > The j script can appear in the shell script as shown.
> > Warning, I modified his j code without testing. (A further optimization
> > would be to read only the last character of the file.)
> > Quoting 'EOF' prohibits parameter expansion in the here document. j
> > programs often contain $ . Copy the following to file (say s.sh),
> > follow it's instructions.
> >
> > #!/bin/bash
> >
> > # $ chmod +rx s.sh # change mode to executable
> > # $ ./s.sh *suspects* # append new lines if necessary to suspect files
> >
> > F=/tmp/j.ijs
> >
> > cat<<'EOF'>$F # copy here document to EOF to file of expanded $F
> > 3 : 0'' NB. If necessary, append LF to files listed on command line
> > for_f. }.ARGV_j_ do.
> > if. LF~:{:1!:1 f do.
> > stdout LF,>f
> > LF 1!:3 f
> > end.
> > end.
> > )
> > exit 0
> > EOF
> >
> > J=/usr/local/j64-701/bin/jconsole
> >
> > exec $J $F $*
> >
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list