Scripting Commands
You can use advanced scripting constructs to combine multiple commands and write complex scripts.
The Shell commands support 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 members agents users groups roles realms machines solutions
Pipes
Output of one command can be piped to the input of another command using a '|'.admin@localhost:> ls TEA/members/Roles | grep a TEA_ADMIN Tomcat Admin Tomcat User
Closures
Closures are functions which can be invoked with arguments. You can define and invoke the functions at run time. Curly braces, '{ ' and '} ' are used to enclose a closure definition.admin@localhost:/TEA> each {ls}{show info $it} Name:TEA Type:tea:2.1:TEA Status:Running Name:Agents Type:tea:2.1:agents Name:Users Type:tea:2.1:users Name:Groups Type:tea:2.1:groups Name:Roles Type:tea:2.1:roles Name:Realms Type:tea:2.1:realms Name:Machines Type:tea:2.1:teaMachines Name:Solutions Type:tea:2.1:solutions
Copyright © Cloud Software Group, Inc. All rights reserved.