Script synax that waits on user input before committing changes?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎02-05-2016 02:36 PM
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.
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎02-07-2016 08:48 PM
Perfect! Thanks a lot!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎02-06-2016 01:14 AM
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.
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎02-05-2016 07:59 PM
Thanks! Any way we can also echo the saving progress without showing the rest of the code?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎02-05-2016 04:30 PM
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
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
