Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-24-2015, 01:00 PM
jbd1300 jbd1300 is offline
Registered User
 
Join Date: Dec 2014
Posts: 18
User input manipulation

Back at it again!

I first want to thank the forum admins and fellow scripters for all the help that all have put work into making this forum into the awesomeness it is!

I am wanting to create a script that takes user input(in the form of an interface), and stores it into an array or container to call later in my script.

We are going to have anywhere from one interface to multiple interfaces.

so for example, we have juniper devices

let's say i have 4 interfaces (The user would enter these in a prompt or text box)

"xe-0/0/0"
"xe-0/1/0"
"xe-0/2/0"
"xe-0/3/0"

Then call the number of interfaces entered from the user, and run them for defined commands

so i am wanting to verify for example:

show interface diagnostic optics "xe-0/0/0"(I want to call this from an element within the array the user entered)
show interface diagnostic optics "xe-0/1/0"(I want to call this from an element within the array the user entered)
show interface diagnostic optics "xe-0/2/0"(I want to call this from an element within the array the user entered)
show interface diagnostic optics "xe-0/3/0"(I want to call this from an element within the array the user entered)

Then later in the script, I am going to need to parse out the interface, so let's say for example we have interface xe-a/b/c, i would then need to parse out "a", "b", and "c"

for example

show chassis pic fpc-slot "a" pic-slot "b"

Could i get some guidance on user input manipulation, arrays, and parsing out strings?

Thanks

jbd1300
 

Tags
#parse , #user input


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:21 PM.