LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] shell quiz !

[ILUG] shell quiz !

John P . Looney john at antefacto.com
Sat Feb 17 12:58:17 GMT 2001


 
 Actually, the winner is Paul Kelly, and his interesting use of "bc";

IP_START=$1
IP_END=$2

IS1=`echo $IP_START | cut -d '.' -f 1`
IS2=`echo $IP_START | cut -d '.' -f 2`
IS3=`echo $IP_START | cut -d '.' -f 3`
IS4=`echo $IP_START | cut -d '.' -f 4`

IE1=`echo $IP_END | cut -d '.' -f 1`
IE2=`echo $IP_END | cut -d '.' -f 2`
IE3=`echo $IP_END | cut -d '.' -f 3`
IE4=`echo $IP_END | cut -d '.' -f 4`

for i in `echo " 
    start=$IS1 * (256^3) + $IS2 * (256^2) + $IS3 * (256^1) + $IS4
    end=$IE1 * (256^3) + $IE2 * (256^2) + $IE3 * (256^1) + $IE4
    
    obase=256
    while (start <= end) {
        start++
    }
" | bc | sed -e 's/ 0*/./g' | sed -e 's/^\.//' | sed -e 's/\.\./.0./' | \
sed -e 's/\.\./.0./' | sed -e 's/\.$/.0/'` 
do
    echo $i
done

-- 
 When I say 'free', I mean 'free': free from bond, of chain or command: 
to go where you will, even to Mordor, Saruman, if you desire. " 
    -- Gandalf, paraphrasing the choice between Free and Non-free software




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell