Posts

Showing posts with the label TCL scripting

TCL scripting

Image
  TCL scripting Tcl uses most of the tcsh commands but the syntax varies. We shall look into tcl commands: Assigning a value to a variable: Set a <value> Eg: set a 10 This prints 10 in the prompt. To print the value of variable : Puts <channel ID> $variable Eg: set a 10 Puts stdout $a Output: 10 To get input of a variable in terminal: Gets <stdin> variable Eg: gets stdin a %10 Output: 2   It prints me length of characters of a given input. Ways of assigning a list to variable: Set a “list of values” Set a {list of values} Set a [list <list of values>] Eg: set a “10 20 30” Eg: set a {10 20 30} Eg: set [list 10 20 30] Command substitution: Command substitution is used for using a command in another command. Eg: puts [expr 10 + 20] Output: 30 The command used for command substitution is: [] Split and join command: Set a {xor_or and nand_nor xnor_not} Split $a “_” Output: {xor} {or and nand} {nor xnor} {not} Join $a “_” Output: xor_or_and_nand_nor_xnor...