Categorie├źn
BASH Tips Uncategorized

BASH Tips

Loop to array

#!/bin/bash ## Array declare -a arr=("x.x.x.x" "x.x.x.x" "x.x.x.x")

## Now Loop for i in "${arr[@]}" do echo $i ## List Shares

`smbclient -L $i -U domain\\user%password`
`echo "--"`

done

 

Loop through subnet to perform reverse dns lookups

#!/bin/bash
for i in $(seq 1 255);
do
echo “request for ” 172.16.5.$i
dig @172.16.5.10 +noall +answer -x 172.16.5.$i +nocookie

done