Prompt for input / edit script?

  • 0
  • 1
  • Question
  • Updated 5 years ago
  • Answered
Create Date: Aug 23 2012 8:29AM

I am writing a 'default' config script, basically to apply all of our default settings for a switch. 

What i would like to do, but can do without, is to prompt the users for a number and assign that number as the IP of the switch.

command equiv:
configure vlan VLAN-Default ipa 192.168.1.X

I know i can make a variable and think i could apply the variable to the command, however i am not sure if it is possible to interupt a script to ask for input / resume script.

I want to know if during a script i can prompt the user to enter a number and apply that number to X / then execute that command and move on.

Alternatively I can tell users to just edit the script each time and change the IP to whatever it needs to be (not use a variable).  I want to IP the switch as part of the general config so that i can also add default route, dns, etc (at least the default route won't enter until the vlan is IP'd).

Thanks
(from Nick_Lindhag)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb

Posted 5 years ago

  • 0
  • 1
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Aug 23 2012 9:45AM

For prompting of variables at the command line.

set var myVar $READ(Description.)

Hope this helps

(from john_padilla)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Aug 26 2012 6:25PM

OR, if you need only one (or two) variables - you can pass them to the script as parameters (using $CLI.ARGV1 ..."load script myScript variable1 variable2")

For more variables, the GUI version is the best one; $READ works anytime so it will be your call in the end.

(from Eugen_NAIMAN)

This conversation is no longer open for comments or replies.