Skip to content

The shell

Jaume Olivé Petrus edited this page Jun 6, 2017 · 34 revisions

Lua RTOS has an integrated shell that allows you to execute certain commands in a linux similar way. The shell is disabled by default, but you can enable it typing os.shell(true) in the prompt or putting os.shell(true) in the system.lua file.

The following explains all the commands supported by the shell.

cat FILE

Print FILE on the standard output.

/ > cat system.lua
-- system.lua
--
-- This script is executed after a system boot or a system reset and is intended
-- for setup the system.

---------------------------------------------------
-- Main setups
---------------------------------------------------
os.loglevel(os.LOG_INFO)   -- Log level to info
os.logcons(true)           -- Enable/disable sys log messages to console
os.shell(true)             -- Enable/disable shell
os.history(false)          -- Enable/disable history
/ > 

cd DIRECTORY

Change the working directory.

/ > cd examples
/examples > 

clear

Clear the terminal screen.

cp SOURCE DESTINATION

Copy the SOURCE file to the DESTINATION file.

/ > cp autorun.lua autorun.old
/ > 

dmesg

Print the syslog contents on the standard output.

Note: dmesg is only available if the underlying storage for your root filesystem is not the SPI FLASH.

reboot

Reboot the system.

ls PATTERN

luac SOURCE [DESTINATION]

Translates programs written in the Lua programming language into binary files that can be later loaded and executed.

DESTINATION is optional, and if it's not provided the compiled filename is the SOURCE filename postfixed with the "c" character.

Example:

-- Compile test.lua into test.luac file
luac test.lua test.luac

-- Compile test.lua into test.luac file
luac test.lua

mkdir DIRECTORY

more FILE

mv SOURCE DESTINATION

Move (rename) SOURCE to DESTINATION.

pwd

Print name of current/working directory.

/examples > pwd
/examples	
/examples > 

rm FILE

Remove FILE.

Clone this wiki locally