-- public domain 20080407 lua@ztact.com require 'luashell' luashell.setfenv () -- magically create functions from $PATH do local foo=bar -- echo is a builtin function -- note that environment and local variables can be accessed via $ echo 'local variable foo is $foo' echo 'PATH is $PATH' cd '$HOME' -- cd is also a builtin function -- the ls function is dynamically created when called -- the ls function will fork and exec /bin/ls ls () ls '-la --sort=size' ls ('-la', '--sort=size') -- similarly, any non-existent function that matches a program -- in $PATH will also be magically created when called tar '--help' end