Better handling of output of 'wc'
This commit is contained in:
parent
9b7f6f9c21
commit
a6245d21a0
1 changed files with 23 additions and 3 deletions
|
@ -6,8 +6,28 @@ if [ ! -f "$INPUT" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NUM_LINES=`cat "$INPUT" | wc -l`
|
NUM_LINES=`cat "$INPUT" | wc -l`
|
||||||
echo "WARNING: $NUM_LINES packages require a reboot:"
|
|
||||||
cat "$INPUT"
|
|
||||||
|
|
||||||
exit 1
|
case $NUM_LINES in
|
||||||
|
0)
|
||||||
|
echo "UNKNOWN: $INPUT is empty"
|
||||||
|
exit 4
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
echo "WARNING: $NUM_LINES package requires a reboot:"
|
||||||
|
cat "$INPUT"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
[2-9]*)
|
||||||
|
echo "WARNING: $NUM_LINES packages require a reboot:"
|
||||||
|
cat "$INPUT"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "UNKNOWN: Unexpected output of 'wc': $NUM_LINES"
|
||||||
|
exit 4
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue