Having only briefly viewed your script, I wanted to point out that I have five computers on the network. At the time I ran the script, there was only one other computer running. When the other computers are running, the nmbscan will print additional ip addsresses and server names. Thus the need for an array.
Code:
buf="${NMBSCAN#*server }" #buf strips "server" and only stores info after server.
SERVER="${buf%%+([$IFS])*}"
buf="${buf#*ip-address }"
IP="${buf%%+([$IFS])*}"
I assumed that the code above will enable more then one entry thus the array.
Here is another example of nmbscan -a
Code:
dp@bt:/home/dp/down$ nmbscan -a
nmbscan version 1.2.5 - bt - Wed Sep 9 14:40:44 PDT 2009
domain MSHOME
master-browser LEN 192.168.1.19 -
server KIDS
ip-address 192.168.1.20
mac-address
server-software Windows 2000 LAN Manager
operating-system Windows 5.1
server LEN
ip-address 192.168.1.19
mac-address
server-software Windows 2000 LAN Manager
operating-system Windows 5.1
Having run the script.
I guess I have run into another problem.
Perhaps you are correct the code below will not allow an array. It only uses one set of ip addresses and computer names. Thus bringing me back to an earlier version of the script.
Code:
buf="${NMBSCAN#*server }" #buf strips "server" and only stores info after server.
SERVER="${buf%%+([$IFS])*}"
buf="${buf#*ip-address }"
IP="${buf%%+([$IFS])*}"
EDIT: A closer look at your version.
Code:
cmd="smbclient -L $IP -A /root/.smbpass"
This will only allow for one ip address.
Code:
IFS="$old_IFS" # Restore now to avoid any unwanted side-effects
if [ ! -d /home/server/$numb/$FILES ]; then
# @@@ Why make a different directory than the one tested for?
echo "mkdir -p /home/server/$SERVER/$LIST"
Should be
Quote:
IFS="$old_IFS" # Restore now to avoid any unwanted side-effects
if [ ! -d /home/server/$SERVER/$LIST ]; then
# @@@ Why make a different directory than the one tested for?
echo "mkdir -p /home/server/$SERVER/$LIST"
|
Probably my mistake.