AstroDroid
05-25-2004, 03:34 PM
I have a shell script that invoices the following command
nbtscan -s : -v 192.168.6.30-254 | grep -e "computername" -i | awk -F: '{print $1}'
The problem is that nbtscan returns the name 3 times. So I get the following output
192.168.6.68
192.168.6.68
192.168.6.68
I need only the first IP.
I use this to launch vnc to the machine, and in it's current state it runs
vncviewer 192.168.6.68 192.168.6.68 192.168.6.68
of course this doesn't work, thoughts?
This makes it easy to run vnc without knowing the IP, so I just type
prog office username
and it finds the ip and logs me in. with no user intervention.
PS -- Bash only please, I know you could do this with perl, but I choose bash. Thanks.
nbtscan -s : -v 192.168.6.30-254 | grep -e "computername" -i | awk -F: '{print $1}'
The problem is that nbtscan returns the name 3 times. So I get the following output
192.168.6.68
192.168.6.68
192.168.6.68
I need only the first IP.
I use this to launch vnc to the machine, and in it's current state it runs
vncviewer 192.168.6.68 192.168.6.68 192.168.6.68
of course this doesn't work, thoughts?
This makes it easy to run vnc without knowing the IP, so I just type
prog office username
and it finds the ip and logs me in. with no user intervention.
PS -- Bash only please, I know you could do this with perl, but I choose bash. Thanks.