From 2eb474afecece4ae688412290a3aebb19b1bc6d0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Jun 2016 14:53:07 -0400 Subject: [PATCH] Discard grep output and display error message --- xCAT/postscripts/remoteshell | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 1a6e3cf4e..82a3f6fab 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -108,7 +108,7 @@ fi getcredentials.awk ssh_dsa_hostkey | grep -E -v '|' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_dsa_hostkey #check the message is an error or not -grep -E '' /tmp/ssh_dsa_hostkey +grep -E '' /tmp/ssh_dsa_hostkey > /dev/null 2>&1 if [ $? -ne 0 ]; then #the message received is the data cat /tmp/ssh_dsa_hostkey | grep -E -v '|/{0,1}data>||' >/etc/ssh/ssh_host_dsa_key @@ -154,7 +154,7 @@ if [ $? -ne 0 ]; then else #the message received is an error, so parse it ERR_MSG=`sed -n 's%.*\(.*\).*%\1%p' /tmp/ssh_dsa_hostkey` - logger -t xcat -p local4.err Error: $ERR_MSG + logger -s -t xcat -p local4.err Error: $ERR_MSG fi rm /tmp/ssh_dsa_hostkey @@ -174,7 +174,7 @@ fi getcredentials.awk ssh_rsa_hostkey | grep -E -v '|' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_rsa_hostkey #check whether the message is an error or not -grep -E '' /tmp/ssh_rsa_hostkey +grep -E '' /tmp/ssh_rsa_hostkey > /dev/null 2>&1 if [ $? -ne 0 ]; then #the message received is the data we request cat /tmp/ssh_rsa_hostkey | grep -E -v '|/{0,1}data>||' >/etc/ssh/ssh_host_rsa_key @@ -220,7 +220,7 @@ if [ $? -ne 0 ]; then else #This is an error message ERR_MSG=`sed -n 's%.*\(.*\).*%\1%p' /tmp/ssh_rsa_hostkey` - logger -t xcat -p local4.err Error: $ERR_MSG + logger -s -t xcat -p local4.err Error: $ERR_MSG fi rm /tmp/ssh_rsa_hostkey @@ -242,7 +242,7 @@ if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then getcredentials.awk ssh_ecdsa_hostkey | grep -E -v '|' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_ecdsa_hostkey #check whether the message is an error or not - grep -E '' /tmp/ssh_ecdsa_hostkey + grep -E '' /tmp/ssh_ecdsa_hostkey > /dev/null 2>&1 if [ $? -ne 0 ]; then #the message received is the data we request cat /tmp/ssh_ecdsa_hostkey | grep -E -v '|/{0,1}data>||' >/etc/ssh/ssh_host_ecdsa_key @@ -296,7 +296,7 @@ if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then else #This is an error message ERR_MSG=`sed -n 's%.*\(.*\).*%\1%p' /tmp/ssh_ecdsa_hostkey` - logger -t xcat -p local4.err Error: $ERR_MSG + logger -s -t xcat -p local4.err Error: $ERR_MSG fi rm /tmp/ssh_ecdsa_hostkey fi