Is there some easy way to resolve names to their windows share. I got annoyed at typing in ip addresses and wrote a quick script to use nmblookup to get the ip address and shove it into the /etc/hosts file. Unfortunately you have to code what hosts it enters. I'd rather have it automatically do it for all machines. (Note: this script isn't quite correct. It doesn't handle some error conditions right and wipes out the /etc/hosts file. If there is interest in the fixed version let me know and I'll get it.) Dennis Payne dulsi@identicalsoftware.com #!/bin/bash function nmbreplacename { answer=`nmblookup $1 | grep -v querying | sed -e 's/.[0-9][0-9].$//g'` if [ `echo $answer | cut -d' ' -f1` = 'name_query' ]; then echo $1 not found else #sedexec='s/^.*zeteta.*$/'$answer'/g' #echo $sedexec if [ -z "`egrep "^.*$1.*$" /etc/hosts`" ]; then echo $answer >>/etc/hosts else sed -e "s/^.*$1.*$/$answer/g" </etc/hosts >/etc/hosts.new mv /etc/hosts.new /etc/hosts fi fi return 0; } nmbreplacename foo nmbreplacename bar
participants (1)
-
Dennis Payne