From: Michael Gernoth Date: Mon, 20 Mar 2017 15:31:00 +0000 (+0100) Subject: check if card alias exists X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/583bcdfcb6b2280220f4cfeeb5bc829ecf3ccdfc check if card alias exists --- diff --git a/supermicro-kvm.pl b/supermicro-kvm.pl index afe0523..91ea8a6 100755 --- a/supermicro-kvm.pl +++ b/supermicro-kvm.pl @@ -48,11 +48,9 @@ sub read_inifile { my %Config = read_inifile("$ENV{HOME}/.rsbs2rc"); -my $hostalias; +my $hostalias = $ARGV[0]; -if (defined($ARGV[0])) { - $hostalias = $ARGV[0]; -} else { +if (!defined($hostalias) || !defined($Config{$hostalias})) { print STDERR "Usage: $0 card-alias\n\n"; print STDERR "card-alias\tone of: "; foreach my $alias (keys(%Config)) {