codeflood logo

Combining Commands

Being able to execute commands by typing in some text is great, but so much power comes from combining commands together.

Revolver contains 2 constructs to combine separate commands together. These are the subcommand and command chaining. Command chaining was introduced in Revolver 3.

Subcommands

Subcommands allow taking the output of one command and using it as an input parameter to another command. Subcommands use the < (less than) operator.

The following example shows using the ga command to retrieve the template ID of an item, but using that as a subcommand within the cd command to navigate to the template item.

cd < (ga -a templateid)

Command Chaining

Command chaining is kind of like the opposite of subcommands. Command chaining takes the output of one command and passes it along to the next command, making the output available for use. Command chaining uses the > (greater than) operator. The output of the previous command is available in the ~ (tilda) variable.

The following example creates a new item in the first command and chains the output (the ID of the new item) along to the next command.

touch -t (sample/sample item) myitem > cd $~$