|
|
 |
 |
 |
 |
TCL(Tool Command Language) Scripting
|
 |
 |
 |
 |
 |
 |
 |
 |
Just a expect snip to handle Ip vs host name.
This is just a snip from a expect, this bit here looks to see if what was given to me was an IP or a DNS name, and if a DNS name then short it up. foo.net.org thus is foo, IP's are not shorted down. The goal being to set up the prompt bash on host name, for later use. Note: Willing to bet that opt var could be done better, maybe a function that returns the sting that might be the prompt ... JB # is it a IP or a name, ie a string. # but if ip, and NOT dns, and device is # set with a name, then this is a final best effort, set opt "\[0-9]" if {[ regexp "$opt" $x ]} { set my_prompt ">$" puts "Hmmm, its a IP Number.\n" }
set opt "\[a-z]|\[A-Z]" if {[ regexp "$opt" $x ]} { set longname "[lindex $argv 0 ]" set name [ split $longname "." ] set x [ lindex $name 0 ] }
# an admin's debug, that would be me, jb puts "XX $x \n"
|
 |
 |
 |
 |
|