LavishScript:Command Syntax

From Lavish Software Wiki
Jump to: navigation, search

Introduction

A command is used to perform an action. Commands are used by specifying the name of the command (a single word), such as:

LSVersion

Some commands produce output. The above command simply displays the current version of LavishScript.

Most commands accept parameters. Parameters are used by following the name of the command with parameters, separated by spaces. For example:

echo Hi my name is Joe

This executes the Echo command, with 5 parameters. The echo command happens to output all of the parameters, separated by spaces, so in most cases, the output of echo will look much like the original command parameters.

Note: The above is the most essential information for basic usage of most commands. If you do not need or wish to know technical details, you may simply stop reading here.

However, multiple spaces will not be considered to be parameters on their own, so:

echo Hi  my name is Joe

... is still 5 parameters, and produces the same output as the above command. To force a space to be part of a parameter, rather than parameter separation, use double quotes around the entire parameter, like so:

echo "Hi  my name is Joe"

This uses the echo command with one parameter. In order to use double quotes in a parameter, the quotes should be escaped by prepending with \ (and furthermore, to use a \ in a parameter, prepend the \ with a \!). It sounds more complicated than it really is.

echo "\"Hi my name is Joe\\\""

Will output exactly this, including the quotes:

"Hi my name is Joe\"

Special Characters

  • (space)
Spaces are used in command syntax to perform parameter separation
  • "
Quotes are used in command syntax to perform parameter grouping
  •  ;
Semi-colons are used in command syntax to perform command separation, such as echo hi;echo hi, which would execute two commands.
  • ${
${ indicates the beginning of a data sequence. The completed data sequence will be reduced in place to text, and may be expanded to become multiple parameters.
  • \
Backslashes are used in command syntax to perform escaping. Escaping changes the context of the following character, which can cause it to be another character, or remove special meaning. For example, to use a quote as part of a parameter, it should be escaped by prepending it with a backslash.

See Also