Rune

From Erights

(Difference between revisions)
Jump to: navigation, search
(Setting up rune)
(Setting up rune)
 
(2 intermediate revisions not shown)
Line 5: Line 5:
'''Windows:''' Copy the file <code>rune-bat-template.txt</code> to <code>rune.bat</code> and edit the settings in the file.
'''Windows:''' Copy the file <code>rune-bat-template.txt</code> to <code>rune.bat</code> and edit the settings in the file.
-
'''unix/linux/mac:''' Copy <code>rune-template.txt</code> to <code>rune</code> and edit it.
+
''Hint:'' If you plan on using rune a lot, you should try [http://sourceforge.net/projects/console Console], a Windows console window enhancement
 +
 
 +
'''unix/linux/mac/cygwin:''' Copy <code>rune-template.txt</code> to <code>rune</code> and edit it.
Add execute rights to the file by entering <code>chmod a+x rune</code>.
Add execute rights to the file by entering <code>chmod a+x rune</code>.
Line 11: Line 13:
As an alternative, rune can be started using the java executable:
As an alternative, rune can be started using the java executable:
-
<code>
+
<code>$ java -jar e.jar --rune</code>
-
java -jar e.jar --rune
+
-
</code>
+
== Running an E script from rune ==
== Running an E script from rune ==
-
There are two ways to start an E script using rune:
+
There are several ways to start an E script using rune.
-
First, you can give the name of the script as a command line argument.
+
 
-
<code>./rune example.e</code>
+
=== Calling the "rune" script explicitly ===
 +
 
 +
Given that the "rune" script is on your PATH, you can give the name of the .e script as a command line argument to rune:
 +
 
 +
<code>$ rune [options...] example.e [args...]</code>
 +
 
 +
The additional args after <code>example.e</code> are available from within <code>example.e</code> as the value of the expression
 +
 
 +
<code>interp.getArgs()</code>
 +
 
 +
For more information on the options, do
 +
 
 +
<code>$ rune --help</code>
 +
 
 +
=== Calling the "rune" shell script implicitly ===
 +
 
 +
On the unix/linux/mac/cygwin platforms, you can place <code>#!/usr/bin/env rune</code> on the first line of example.e, make example.e executable, and use it directly as a command:
 +
 
 +
<code>$ example.e [args...]</code>
 +
 
 +
On cygwin, text files beginning with a "#!" are automatically considered executable.
 +
 
 +
=== Calling the "rune" function from within a running E system ===
 +
 
 +
You can start the script directly from the E command prompt, which can save some time because the running Java VM is used:
 +
 
 +
<code>? rune(["example.e"])</code>
 +
 
 +
=== Launching from the desktop ===
-
The second way is to start the script from the E command prompt:
+
Currently on Windows only, you can double click on the shortcut icon for <code>example.e</code> in the file explorer (desktop).
-
<code>? rune(["example.e"])</code>
+
-
The second method can be faster if you want to start a script more than once, for example for testing. The java virtual machine is only started once, which can save some seconds.
+
== Command history ==
== Command history ==
The interactive E interpreter does not provide command history. Under windows, the shell has its own command history, which can be used by pressing the up and down arrow keys.
The interactive E interpreter does not provide command history. Under windows, the shell has its own command history, which can be used by pressing the up and down arrow keys.
-
If your system does not provide command history, you can try [http://freshmeat.net/projects/rlwrap/ RLWrap].
+
If your system does not provide command history, you can try [http://freshmeat.net/projects/rlwrap/ rlwrap].

Latest revision as of 22:52, 15 March 2007

Rune is the interactive command line interpreter for E code.

Contents

Setting up rune

Windows: Copy the file rune-bat-template.txt to rune.bat and edit the settings in the file.

Hint: If you plan on using rune a lot, you should try Console, a Windows console window enhancement

unix/linux/mac/cygwin: Copy rune-template.txt to rune and edit it. Add execute rights to the file by entering chmod a+x rune.

You should now be able to execute rune and get an interactive shell.

As an alternative, rune can be started using the java executable:

$ java -jar e.jar --rune

Running an E script from rune

There are several ways to start an E script using rune.

Calling the "rune" script explicitly

Given that the "rune" script is on your PATH, you can give the name of the .e script as a command line argument to rune:

$ rune [options...] example.e [args...]

The additional args after example.e are available from within example.e as the value of the expression

interp.getArgs()

For more information on the options, do

$ rune --help

Calling the "rune" shell script implicitly

On the unix/linux/mac/cygwin platforms, you can place #!/usr/bin/env rune on the first line of example.e, make example.e executable, and use it directly as a command:

$ example.e [args...]

On cygwin, text files beginning with a "#!" are automatically considered executable.

Calling the "rune" function from within a running E system

You can start the script directly from the E command prompt, which can save some time because the running Java VM is used:

? rune(["example.e"])

Launching from the desktop

Currently on Windows only, you can double click on the shortcut icon for example.e in the file explorer (desktop).

Command history

The interactive E interpreter does not provide command history. Under windows, the shell has its own command history, which can be used by pressing the up and down arrow keys. If your system does not provide command history, you can try rlwrap.

Personal tools
more tools