Simple Command Line Script Execution

lua-users home
wiki

Difference (from prior major revision) (no other diffs)

Changed: 3,5c3,6
echo "print(\"Hello, World\")" > test.lua

lua test.lua

$ echo "print(\"Hello, World\")" > test.lua
$ lua test.lua


Added: 8a10
{{{

Added: 9a12,20
}}}

Another way for simple code is to pipe the script directly into Lua:


$ echo "print(\"Hello, World\")" | lua


The output is the same.

To Execute a script from the command line, e.g from a NSLU2 running openWrt Kamikaze 8.09rc2 with Lua in the path:

$ echo "print(\"Hello, World\")" > test.lua
$ lua test.lua

The result is:

Hello, World

Another way for simple code is to pipe the script directly into Lua:

$ echo "print(\"Hello, World\")" | lua

The output is the same.


RecentChanges · preferences
edit · history
Last edited December 22, 2018 10:41 pm GMT (diff)