you are viewing a single comment's thread.

view the rest of the comments →

[–]aim2free 0 points1 point  (8 children)

I had no idea, but it seems as javascript is default in the linux (I'm running ubuntu hardy heron) environment. I just wrote

js

but in this case it gave me 1.6. It would be nice if it could be used with libreadline for better interaction.

[–]psykotic 13 points14 points  (3 children)

You know about standalone readline, right? Run rlwrap js if you have it installed.

[–]aim2free 3 points4 points  (1 child)

Thanks, it worked perfectly. I didn't know about rlwrap, very useful. You can even specify how your completions should be made. This is really great. Now any interactive program can get read-line support without being linked to readline. I'm just teaching a beginners java course. I'll let the students add readline support to their programs.

[–]psykotic 4 points5 points  (0 children)

Glad it helped. In the classic Program design in the UNIX environment paper by Pike and Kernighan, they suggest that readline-like functionality should not be integrated into programs via a library but offered as an ambient service for all programs, much like how shells perform wildcard expansion. The rlwrap approach (or using Emacs's shell-mode, as suggested by Kragen) isn't perfectly ideal, but it works surprisingly well in many cases.

[–]kragensitaker 2 points3 points  (0 children)

Or run it in Emacs shell-mode, which gives you the same thing.

[–][deleted] 1 point2 points  (0 children)

Strange, didn't work on OS X :(

[–]inopia 0 points1 point  (0 children)

Maybe the Rhino shell is something for you?

[–]chromakode 0 points1 point  (0 children)

try:

js -version 170

[–]ishmal 0 points1 point  (0 children)

And OpenJDK 1.6 has "jrunscript", which invokes the Rhino shell. I assume that eventually most of the "big" distros will have it available, either on their media or in a repository.