>>>>> "amit" == amit soni <[EMAIL PROTECTED]> writes:
amit> Ok !...who will tell me what this perl waste does ?
amit> and how is this route command useful ? Any alternate method to acheive this
same objective ?
amit> Using Python/PHP/C something which I can make a head or tail of !
amit>
----------------------------------------------------------------------------------------------------------------
amit> #!/usr/bin/perl
amit> $del=$ARGV[0];
amit> $count=0;
amit> @ips=`cat /etc/.ipaliases.data`;
amit> foreach $ips (@ips) {
amit> chop($ips);
amit> if ($ips =~ /\d/) {
amit> if($del==1) {
amit> system "/sbin/ifconfig eth0:$count- $ips";
amit> $count++;
amit> next;
amit> }
amit> system "/sbin/ifconfig eth0:$count $ips";
amit> system "/sbin/route add -host $ips dev eth0:$count";
amit> $count++;
amit> }
amit> }
amit>
----------------------------------------------------------------------------------------------------------------
Gets a list of IP aliases from /etc/.ipaliases.data. If called
without any arguments, creates aliases for eth0 with those IP's
starting with eth0:0 and continuing sequentially from there. If
called with an argument of 1, deletes all the aliases.
I don't like the way this script is written -- it's too fragile -- but
it'll work. It's quite easy to make both head and tail of if you know
Perl programming (took me about 15 seconds). If you don't know a
language, then any program in that language is gibberish -- I can't
understand Java, for instance, source looks like crap to me :-)
Regards,
-- Raju
--
Raju Mathur [EMAIL PROTECTED] http://kandalaya.org/
It is the mind that moves
================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
=================================================