Scripting Commands
You can use advanced scripting constructs to combine multiple commands and write complex scripts.
The Shell commands supports the following advanced constructs for scripting:
Arrays
Arrays can be passed as arguments to some commands. For example, the
echo command takes an array of arguments passed to it and displays them at the command prompt.
echo [ 'a' 'b' 'c'] "a" "b" "c"
Running Multiple Commands at Once
Multiple commands can be run by separating them with a
';' (semicolon).
admin@localhost:/> cd /TEA;ls Access Agents Search Server Shell Tea Machines Tea Repository Tea Solutions Types Views
Pipes
Output of one command can be piped to the input of another command using a '|'.admin@localhost:> ls /TEA/Types | grep a tea:1.0.0
Command Grouping
Multiple commands can be grouped using parenthesis, '( ' and ') ' to specify the order of execution.(echo a | capture) | capture
Closures
Closures are functions which can be invoked with arguments. You can define and invoke the functions at runtime. Curly braces, '{ ' and '} ' are used to enclose a closure definition.admin@localhost:> each { ls } {show info $it}
Name:Access
Type:tea:1.0.0:access
Config:
{"activeUsers":[]}
Name:Agents
Type:tea:1.0.0:agents
Name:Search
Type:tea:1.0.0:search
Name:Server
Type:tea:1.0.0:server
Config:
{"version":"1","homeLocation":"..\:\\tea"}
Name:Shell
Type:tea:1.0.0:ShellType
Status:RUNNING
Config:
{"host":"localhost","port":2222,"path":"..\\internal\\nodes\\node1\\work\\cf
\\bcd28823-db70-48be-84d5-6c2295667295\\work\\hostkey.ser"}
Name:Tea Machines
Type:tea:1.0.0:teaMachines
Name:Tea Repository
Type:tea:1.0.0:teaRepository
Name:Tea Solutions
Type:tea:1.0.0:solutions
Name:Types
Type:tea:1.0.0:agent_types_group
Name:Views
Type:tea:1.0.0:views
admin@localhost:>
Copyright © Cloud Software Group, Inc. All Rights Reserved.