Command Substitution

Command substitution allows a command to be run and its output to be pasted back on the command line as arguments to another command. FireCMD also allows command substitution using a file.

FireCMD uses a pair of operators for command substitution. The "+|" and "|" operators can be used for normal command substitution and for command substitution using files, the operators "+<" and "<" can be used.

Example: wc "+|openfile|"

In the above example, the openfile command gets executed first and allows the user to select a file and then it's output is passed as an argument to wc command after removing the line feeds. wc is a UNIX command which counts the number of characters, words and lines in a file.

When FireCMD finds the operator "+|" it looks for a matching operator "|". If it is not found, it displays an error. Remember that the command substitution cannot be nested. The built-in commands should be avoided in command substitution as they don't print anything on the standard output.

Example: echohtml <i> +<greetings.txt< </i>

In above example the contents of greetings.txt file is pasted between the <i> and </i> HTML tags and then it is passed as an argument to echohtml command which finally displays the contents in italic font.

Listing aliases - FireCMD

Note that the line feeds are not removed when command substituting from files but if used with echohtml command the line feeds will be removed as in HTML a <br/> tag is used for line break..


Documentation Index Page