So here is how my script goes:
Note that : pkg/bin/perl is the correctly pointed path to perl on netbsd.
#!/usr/pkg/bin/perl
use strict;
use warnings;
my $name = $ENV{USER};
if ( $name ne "root" ) {
print "please become root first\n";
exit;
}
print "Update Menu\nHow would you like to update?\n\n1.SUP (Recommended)\n2.Tar\n";
my $menu = <STDIN>
if ( $menu == "1") {
system("sup -v /usr/share/examples/supfiles/pkgsrc");
}
if ( $menu == "2" ) {
system("cd /usr/pkgsup; wget ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz.MD5");
my $check = `/scripts/awk`;
my $file = `/scripts/check`;
if ( $check ne $file ) {
system("cd /usr/pkgsup; rm /usr/pkgsup/pkgsrc.tar.gz; wget ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz; tar xvfz pkgsrc.tar.gz;");
print "Working...\n";
system("rm -rf /usr/pkgsrc; mv /usr/pkgsup/pkgsrc /usr/pkgsrc;");
}
print "update complete\n";
system("rm /usr/pkgsup/pkgsrc.tar.gz.MD5;");
}
The error i get is:
Global symbol "$menu" requires Explicit package name at ./pkgsup line 15.
Syntax error at ./pkgsup line 15, near ") {"
Execution of ./pkgsup aborted due to compilation errors.
Please help me, I have been eyeballing line 15 forever to see where the error is but I cant see it at all. Anyways thank you for reading and considering my question. I will be grateful for any useful replies.
Thank you "Jason C" This was a generic test of if people on yahoo answers actually answer a simple programming question if put into the correct category and waited within a day. I am happy to say it took only 14 minutes for this person to see the pattern of a missing ; which I removed for this test. Yes, this script will now work if you place that ; back in.
It's sad to see none of the top contributors of this section actually posting here. Perhaps they can argue that they don't know perl but instead python or the ever so loved html (which isn't a programming language technically). Anyways thank you again for the correct answer in under a quarter of an hour and I hope yahoo answers sees this as a balance of your skills and gets you close to getting or as a top contributor.
Note that : pkg/bin/perl is the correctly pointed path to perl on netbsd.
#!/usr/pkg/bin/perl
use strict;
use warnings;
my $name = $ENV{USER};
if ( $name ne "root" ) {
print "please become root first\n";
exit;
}
print "Update Menu\nHow would you like to update?\n\n1.SUP (Recommended)\n2.Tar\n";
my $menu = <STDIN>
if ( $menu == "1") {
system("sup -v /usr/share/examples/supfiles/pkgsrc");
}
if ( $menu == "2" ) {
system("cd /usr/pkgsup; wget ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz.MD5");
my $check = `/scripts/awk`;
my $file = `/scripts/check`;
if ( $check ne $file ) {
system("cd /usr/pkgsup; rm /usr/pkgsup/pkgsrc.tar.gz; wget ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.gz; tar xvfz pkgsrc.tar.gz;");
print "Working...\n";
system("rm -rf /usr/pkgsrc; mv /usr/pkgsup/pkgsrc /usr/pkgsrc;");
}
print "update complete\n";
system("rm /usr/pkgsup/pkgsrc.tar.gz.MD5;");
}
The error i get is:
Global symbol "$menu" requires Explicit package name at ./pkgsup line 15.
Syntax error at ./pkgsup line 15, near ") {"
Execution of ./pkgsup aborted due to compilation errors.
Please help me, I have been eyeballing line 15 forever to see where the error is but I cant see it at all. Anyways thank you for reading and considering my question. I will be grateful for any useful replies.
Thank you "Jason C" This was a generic test of if people on yahoo answers actually answer a simple programming question if put into the correct category and waited within a day. I am happy to say it took only 14 minutes for this person to see the pattern of a missing ; which I removed for this test. Yes, this script will now work if you place that ; back in.
It's sad to see none of the top contributors of this section actually posting here. Perhaps they can argue that they don't know perl but instead python or the ever so loved html (which isn't a programming language technically). Anyways thank you again for the correct answer in under a quarter of an hour and I hope yahoo answers sees this as a balance of your skills and gets you close to getting or as a top contributor.