For quick and dirty execution of a J phrase from the command line, you can
use the "-js" option.  So, if I want to time the inversion of a 1000 x 1000
matrix in J, I could enter this on the command line:
e:/Users/DevonMcC/j64-807/bin/jconsole -js "2!:55'' [ smoutput 6!:2 '%.mat'
[ mat=. <:+:1000 1000?@$0"
The " 2!:55 '' " logs off the session after it outputs (smoutput) the
timing (6!:2) of the expression to invert the matrix "mat".

Note that changing the directory in such a command-line string only affects
the J session, not the calling session, so, from my command line:
[Wed 03/27/2019 | 18:34:20.13 | E:\amisc\logs]
>e:/Users/DevonMcC/j64-807/bin/jconsole -js "2!:55'' [ smoutput 1!:43 '' [
1!:44 'C:/Temp'"
e:/Users/DevonMcC/j64-807/bin/jconsole -js "2!:55'' [ smoutput 1!:43 '' [
1!:44 'C:/Temp'"
C:\Temp

[Wed 03/27/2019 | 18:34:45.08 | E:\amisc\logs]
>
Here I changed to "C:/Temp", showed that's my current directory, then
exited; you can see from my prompt that I remain in the original calling
directory after the J expression finished.



On Wed, Mar 27, 2019 at 5:49 PM bill lam <[email protected]> wrote:

> strange that you mentioned ijx, which version of J are you using?
>
> On Thu, Mar 28, 2019, 5:25 AM Kevin Wang <[email protected]> wrote:
>
> > I am new to J and am trying to figure out how to find the directory my
> ijx
> > is running in and how to change it. I have looked in the Foreigns vocab
> > section and thought it would be better to ask now instead of scrambling
> all
> > over the wiki.
> >
> > Also, how can I run an ijs script file from the command line, either a
> > Windows command prompt or a Bash terminal?
> >
> > Thanks,
> > Kevin Wang
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to