From 583bcdfcb6b2280220f4cfeeb5bc829ecf3ccdfc Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Mon, 20 Mar 2017 16:31:00 +0100 Subject: [PATCH] check if card alias exists --- supermicro-kvm.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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)) { -- 2.39.5