Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for I in 1 2 3 4 5
- do
- statements1 #Executed for all values of ''I'', up to a disaster-condition if any.
- statements2
- if (condition)
- then continue #Go to next iteration of I in the loop and skip
- statements3
- fi
- Following shell script will go though all files stored in /etc directory. The for loop will be abandon when /etc/resolv.conf file found.
- #!/bin/bash
- for file in /etc/*
- do
- if [ "${file}" == "/etc/resolv.conf" ]
- then
- countNameservers=$(grep -c nameserver /etc/resolv.conf)
- echo "Total ${countNameservers} nameservers defined in ${file}"
- break
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement