lxinitd handbook


lxinitd, lxmenu, and rosh share the same litesh syntax.

Basic Syntax

litesh scripts contain one command per line with arguments.

Here's an example from an lxc container /etc/init.d/rcS.


/sbin/mount -a
/sbin/ip addr add dev eth0
/sbin/ip route add default via
# start the process

Blank lines are ignored, lines that start with # are comments.

Each line is executed as a subprocess, except limited builtins.

Commands are executed with execv() so they repect $PATH and require absolute paths or ./.


The shebang (#!/bin/rosh) is required, even if started with /bin/rosh script

The shebang does not accept arguments or switches.

Textual content

The following rules apply to the content of scripts

  • max 2048 line length
  • max 10 arguments to a command
  • ascii 7bit only, no tabs, no invisible chars apart from space ' ' and \n
  • no \0 characters
  • no utf-8


\n exclusivly splits commands, use of \r is an error.

Whitespace character (ascii 20) exclusivly splits args. No support for $IFS.

The double quote character " is used to wrap strings with spaces. To print quote or slash use standard C string escaping \\ and \".


builtins are commands that can be executed without ./


The builtins available are dependent on the context.

Environment variables

In shell environments (rosh, lxinitd) environment varaibles expansion is supported. Scripts use ${var} syntax, brackets are requried. Emtpy variables result in the empty string "", variables placed together are concatenated.


echo ${USER}
echo $USER              # syntax error
echo ${USER}${USER}     # concatenated
echo "${USER}${USER}"   # concatenated
echo "${USER} ${USER}"  # concatenated
echo ${USER} ${USER}    # not concatenated


Branching is supported with if, elif, else, fi.


if command
    echo ${var2}
elif command
    echo ${var2}
    echo ${var3}

The command is forked and exiting zero is considered true. N.B. in order for useful branching it may be useful to copy /usr/bin/test and symlink /usr/bin/[, this is not done by default in lxinitd containers.

The commands "true" and "false" are handled by builtins and do not fork.

if ${debug}
    echo ${var2}

A future version may implement [[, syntax should be considered reserved.

by teknopaul