cancel
Showing results for 
Search instead for 
Did you mean: 

Script synax that waits on user input before committing changes?

Script synax that waits on user input before committing changes?

Stephen_Stormon
Contributor
We want to create a script that will do the following:

show port 5:2,6:1 info
Wait for user to answer if the ports shown are the correct ports to be disabled
If yes execute "disable port 5:2,6:1", then execute "save config"
If no abort

I haven't been able to find a tcl example that incorporates waiting for user input with a if/then.

5 REPLIES 5

Stephen_Stormon
Contributor
Perfect! Thanks a lot!

Matthew_Helm1
Extreme Employee
Well, not really the saving process... but I added the "show var cli.out" after the "save" line and below is that is the output.

disable clipset var ports "1,2"
set var cli.out 0
show ports $ports info detail
show var cli.out
set var ok $TCL(concat "Disable ports" $ports "?")
show var ok
set var ok $READ(yes or no?)
set var t $TCL(string equal $ok "yes")
if $t then
disable port $ports
save
show var cli.out
endif

....

Disable ports 1,2 ? yes or no?
yes
The configuration file primary.cfg already exists.
Saving configuration on master Node .. done!
Configuration saved to primary.cfg successfully.

Stephen_Stormon
Contributor
Thanks! Any way we can also echo the saving progress without showing the rest of the code?

Matthew_Helm1
Extreme Employee
or something like:

disable clip
set var ports "1,2"
set var cli.out 0
show ports $ports info detail
show var cli.out
set var ok $TCL(concat "Disable ports" $ports "?")
show var ok
set var ok $READ(yes or no?)
set var t $TCL(string equal $ok "yes")
if $t then
disable port $ports
save
endif
GTM-P2G8KFN