#!/usr/bin/perl #print "ARGV:", $#ARGV; if ($#ARGV == 2 ) { my $host = $ARGV[0]; my $fn = $ARGV[1]; my $value = $ARGV[2]; #print "INPUTS: host:$host, fn:$fn, value:$value\n\n"; $systemsconfig = '/usr/local/etc/system.ini'; system("cp $systemsconfig /tmp/reconfig"); open CONFIG, "+< $systemsconfig" or die "Couldn't open $systemsconfig"; $^I = ".bak"; while () { if ( $_ =~ m/^\[$host\]/ .. m/#END/ ) { $_ =~ s/$fn=(.*)/$fn=$value/; print; # i thought print CONFIG here??? } } close CONFIG; } #### [bdstest] MainFunction= SystemType=U5 Env= Location= Serial=FW0094810719 Hostid=80c0dc14 OS=Solaris Version=8 Disk=1x8 Memory=128 CPU=1x360 qfe= SCSI= GraphACC= SupportContract= #END [custard] MainFunction= SystemType=U5 Env= Location= Serial=FW00250126 Hostid=80c0aee2 OS=Solaris Version=8 Disk=1x8 Memory=256 CPU=1x360 qfe= SCSI= GraphACC= SupportContract= #END #### /usr/local/etc/test.pl bdstest MainFunction oracle