Question : Please convert the shell script to Perl

Can anybody please convert this shell script to Perl PLease

Answer : Please convert the shell script to Perl

This script creates a bash shell script, then uses bash to run that shell script, then deletes it.
Changing this to a perl script will not remove the need for bash.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
#!/usr/bin/perl
#KSOS=OS Type
#KSNAME=HostName
#KSIPADDR=IP Address
#KSSNET=Subnet Address
#KSGW=Gateway
#set -x
 
sub printget {
	print shift;;
	my $in=;
	chomp $in;
	return $in;
}
 
my $KSNAME=printget("Server Name: ");
my $KSIPADDR = printget("Server IP Address: ");
my $KSSNET=printget("Subnet Mask: ");
my $KSGW=printget("Default Gateway: ");
my $KSOS = printget("Target OS: [332|432|464] ");
my $KSDITRIB = printget("Dristribution [AS|ES] ");
 
system("cp --reply=yes  /ISO/ks/$KSOS.ks /ISO/BOOTCD/$KSOS/ks.cfg");
system("cp --reply=yes  /axa-lci/serverconfigs/US/$KSOS.conf /axa-lci/serverconfigs/US/$KSNAME.conf");
 
open(KSNAME, ">./$KSNAME.sh") or die "Could not open ./$KSNAME.sh: $!\n";
print KSNAME "sed -i 's/NNAME/$KSNAME/g' /ISO/BOOTCD/$KSOS/ks.cfg";
print KSNAME "sed -i 's/NNAME/$KSNAME/g' /axa-lci/serverconfigs/US/$KSNAME.conf";
print KSNAME "sed -i 's/NDISTRIB/$KSDITRIB/g' /axa-lci/serverconfigs/US/$KSNAME.conf";
print KSNAME "sed -i 's/NIPADDR/$KSIPADDR/g' /ISO/BOOTCD/$KSOS/ks.cfg";
print KSNAME "sed -i 's/NIPADDR/$KSIPADDR/g' /axa-lci/serverconfigs/US/$KSNAME.conf";
print KSNAME "sed -i 's/NSNET/$KSSNET/g' /ISO/BOOTCD/$KSOS/ks.cfg";
print KSNAME "sed -i 's/NGW/$KSGW/g' /ISO/BOOTCD/$KSOS/ks.cfg";
 
print KSNAME "mkisofs -o /ISO/BOOTCD/$KSNAME.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table  /ISO/BOOTCD/$KSOS";
system("/bin/bash ./$KSNAME.sh");
unlink("./$KSNAME.sh") or die "Could not remove $KSNAME.sh: $!\n";
Open in New Window Select All
Random Solutions  
 
programming4us programming4us