For -q option, as man grep says: Exit immediately with zero status if
any match is found, even if an error was detected.
So when matching, the read side of pipe is closed by "grep -q", while
the write side still try to write more data, which cause SIGPIPE to the
process, and the shell can not exit with 0.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
dracut-kdump.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index b75c2a5..b5b4f74 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -55,7 +55,7 @@ dump_raw()
echo "kdump: saving to raw disk $_raw"
- if ! $(echo -n $CORE_COLLECTOR|grep -q makedumpfile); then
+ if [ ! $((echo -n $CORE_COLLECTOR|grep makedumpfile) &> /dev/null) ]; then
_src_size=`ls -l /proc/vmcore | cut -d' ' -f5`
_src_size_mb=$(($_src_size / 1048576))
monitor_dd_progress $_src_size_mb &
--
2.7.4