From e32f6915ef8f5b9d32d8d0b652f220579dd43578 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Sun, 25 Feb 2018 13:49:51 -0400 Subject: [PATCH] AK2: fix insert_line wc/ash bad number error when missing file --- tools/ak2-core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index 53b5fc0..48fee83 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -384,7 +384,7 @@ insert_line() { after) offset=1;; esac; line=$((`grep -n "$4" $1 | head -n1 | cut -d: -f1` + offset)); - if [ "$(wc -l $1 | cut -d\ -f1)" -lt "$line" ]; then + if [ -f $1 ] && [ "$(wc -l $1 | cut -d\ -f1)" -lt "$line" ]; then echo "$5" >> $1; else sed -i "${line}s;^;${5}\n;" $1;