Here's a sketch. If you like this approach, let me know and we can polish it up (wrap it in scripts, deal with prompting, maybe address quoting issues...). It uses unix domain sockets, but hopefully you won't mind that - we can use a program like netcat to listen to them.
In one console window, set up a unix domain socket (let's say /tmp/j) which a jconsole session listens to: while nc -lU /tmp/j; do rm /tmp/j; done | /Applications/j64-804/bin/jconsole Apparently nc exits after each client session, and will not start again while the socket exists, so the while loop and rm work around these issues. In another console window, send stuff to that socket: echo 1+1 | nc -U /tmp/j echo i. 3 4 | nc -U /tmp/j echo "exit ''" | nc -U /tmp/j echo | nc -U /tmp/j Exiting reveals a couple issues - one is that command line quoting is similar to j quoting, so you'll have to deal with both. Another is that that while loop will need an extra line sent to it after J exits, to notice that nothing is listening to it any more. Is this close to what you had in mind? Thanks, -- Raul On Sun, Nov 8, 2015 at 11:40 PM, Ian Clark <earthspo...@gmail.com> wrote: > In Mac/Linux, How can I use the command line (in Mac Terminal, say) to > send repeated phrases to jconsole, without losing continuity between J > sessions? > > The help page: http://jsoftware.com/help/user/cmdline.htm > explains how to call jconsole, offering these examples: > > Example 1 > $ jconsole -js a=.23 b=.3 "echo a*b" "exit''" > > Example 2 > $ jconsole -js a=.23 b=.3 "echo a*b" > > These work for me (provided I use a full pathname in place of > "jconsole", which avoids a name-clash with an eponymous Java > executable.) > > Example 1 quits jconsole, losing the contents of all locales. > > Example 2 doesn't quit, but I can't see how to get the command line > prompt back again (in place of the J prompt) without quitting > jconsole. > > I want to be able to conduct a command line session something like this: > > $ jconsole -js a=.23 b=.3 "echo a*b" > $ ... > $ jconsole -js "echo a+b" > ...etc > > I'm already using a software product (EigenD) which has a Unix > executable (brpc) which is used in precisely this way. Can jconsole be > used in a similar way? > > Someone's going to ask me: what am I trying to do? I'll be happy to > explain, plus explain why I want to avoid socket programming. But a > "yes" to my question avoids me having to go into detail. > > However there's a silly solution to my problem, which I suppose I > ought to mention. It is to leave the J process just as it is, i.e. > stateless: > > $ jconsole -js a=.23 b=.3 "echo a*b" "dump'cache.xml'" "exit''" > $ ... > $ jconsole -js "reload'cache.xml'" "echo a+b" "dump'cache.xml'" "exit''" > > This'd probably work fine for small data. But it wouldn't scale. > > Can we do better than that? > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm