I was a bit too quick with that last patch: too many "'s overlloked :-(

The problem is a bit more tricky to fix.
New patch attached.

ael


--- 00check-network-cable_broken	2014-08-21 14:48:47.998575266 +0100
+++ 00check-network-cable	2014-08-21 20:10:45.217430736 +0100
@@ -67,17 +67,27 @@
 	return $status
 }
 
-check_status_ethtool() {
-	local status=0
-	local LINK="$($ETHTOOL "$IFACE" 2>&1 | grep "Link detected" || :)"
-
-	# If ethtool fails to print out the link line we break off
+check_link () {
+	# If ethtool fails to print out the link line we assume OK
 	# notice that ethtool cannot get the link status out of all
 	# possible network interfaces
-	[ "$LINK" ] || return 1
-	if ! echo $LINK | grep -q "Link detected: yes"; then
-		status=1
+
+	if echo "$*" |grep -q "Link detected" ;
+		then 
+                 echo "$*" | grep -q "Link detected: yes" ;
+                  return
+		else
+		 return 1 ;
 	fi
+}
+
+check_status_ethtool() {
+	local status
+	local Old_IFS="$IFS"
+	IFS=
+	check_link $($ETHTOOL "$IFACE" | grep "Link detected" )
+	status=$?
+	IFS="$Old_IFS"
 	return $status
 }
 

Reply via email to