Response to John Baker's request for unix shell script
Message-ID:
<CABc=tNyZuqgGK4tL0aRAXRkb7=ozddfo9pyfol2p+zuaau4...@mail.gmail.com>
and a follow on to bill lam's message
Message-ID: <[email protected]>
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