Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

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 ...


# 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"
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc