From 3511cf93ec19bee75b028ed9fae0e856d8ba0671 Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Tue, 25 Apr 2017 08:42:31 +0200 Subject: [PATCH] supress warnings if ENV not set and be more verbose --- sshdyndns | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sshdyndns b/sshdyndns index f32bfcb..52ea146 100755 --- a/sshdyndns +++ b/sshdyndns @@ -50,8 +50,10 @@ if (!defined $server) { pod2usage(1); } -if($ENV{SSH_CLIENT}=~/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) (\d{1,5}) 22$/) { +if(exists $ENV{SSH_CLIENT} && + $ENV{SSH_CLIENT}=~/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) (\d{1,5}) 22$/) { $ip = $1; + say 'Connection from ', $ip if ($verbose); } else { say STDERR "cannot pare remote IP"; pod2usage(1);