At 08:58 -0700 2006/09/22, [EMAIL PROTECTED] wrote:
Joey,
At Fri Aug 25 01:15:52 2006 you wrote,
jkt> If you want to interpret a j script in Linux you can do
jkt> something like the following (which uses my path conventions)
jkt> ...
jkt> exit 0
jkt> )
Thanks. That appears to be what I need.
So we have a Linux shell script which immediately
invokes the jconsole.
3 : 0 ARGV specifies how to handle the command
line arguments? Definitely new to me.
ARGV is a global that comes into a #! script from
the command line. It includes the path to the script
interpreter, the command that invoked the script,
and any arguments (with file names expanded) e.g.
iMg5:~/Desktop jkt$ cat foo
#! /usr/local/bin/ja
3 : 0 ARGV
stdout , LF,.~ ": y
exit 0
)
iMg5:~/Desktop jkt$ ./foo arg1 *zip
+-----------------+-----+----+-------+-----------+------------+
|/usr/local/bin/ja|./foo|arg1|132.zip|angsx10.zip|pxformat.zip|
+-----------------+-----+----+-------+-----------+------------+
iMg5:~/Desktop jkt$
which shows that I had three *.zip files in the
environment where the script was invoked.
So, the 3 : 0 ARGV line defines a j verb with a
script following and ending with a ) alone on a
line (just as in a j session) Actually, the script
will work without the ending ) but I think it is
"good form" to keep it there. The right argument
(y) of the script is given as the environment
variable ARGV - again, you could simply use that
as a global in the verb, but I think the style of
passing its value as y is more pleasing (to me).
stdout NL,~": q: ". >2{y does the calculation,
formats the result and puts it on stdout (q:
is also new to me).
q: is the j primitive to find prime factors, see
the dictionary.
My shell scripting skills are minimal. Why
the ) after exit 0?
Thanks, ... Peter E.
Desktops.OpenDoc http://carnot.pathology.ubc.ca/
Cool picutre of your model shop at the above link!!
- joey
PS - if you want to take the discussion out of forum
I would be happy to share more scripts or have a
go at putting something together that you could
use for what you are trying to do.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm