#!/usr/bin/perl -w use strict; use diagnostics; if ($#ARGV < 0){ &printusage; } # Check and make sure there are args before doing # anything with them my @args=@ARGV; my $argcnt=$#ARGV; &main; sub main{ my $arg=$args[0]; my ($help,$qmark)=($arg,$arg); my $path=$ENV{HOME}."/bin/"; my $filesuffix=".config"; my $file; if(($help=~/help/)||($qmark=~/\?/)){ &printusage; }elsif ($argcnt != 0){ printf("Error - too few arguments.\n"); &printusage; } $file = $path."$arg".$filesuffix; if (-e $file){ printf("Changing to scheme $arg\n"); system("$path/net_down"); system("sudo modprobe ath_pci"); system("sudo ifup -i $file ath0"); system("$path/ntp_up"); system("$path/tunnel"); } else { printf("Config file: $file does not exits. Exiting\n"); exit(0); } } sub printusage{ print "Usage is: net_up scheme\n"; print "a scheme.config file must exist in \~/bin\n"; exit(0); }