summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2014-09-18 19:03:01 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2014-09-18 19:03:01 +0900
commit4ee85f11e8b3474ae5ea4a292799f849c5fd9c02 (patch)
treef549173059396523de430e830261963fb078386f /install
parent829c7f909c4c875b423be19e3d41f493f9cf2b08 (diff)
[install] Join line numbers when multiple matches found
Diffstat (limited to 'install')
-rwxr-xr-xinstall8
1 files changed, 4 insertions, 4 deletions
diff --git a/install b/install
index 67fda009..bb81c27d 100755
--- a/install
+++ b/install
@@ -338,15 +338,15 @@ append_line() {
echo " - $1"
[ -f "$2" ] || touch "$2"
if [ $# -lt 3 ]; then
- line=$(\grep -nF "$1" "$2" | sed 's/:.*//')
+ line=$(\grep -nF "$1" "$2" | sed 's/:.*//' | tr '\n' ' ')
else
- line=$(\grep -nF "$3" "$2" | sed 's/:.*//')
+ line=$(\grep -nF "$3" "$2" | sed 's/:.*//' | tr '\n' ' ')
fi
if [ -n "$line" ]; then
- echo " - Already exists (line #$line)"
+ echo " - Already exists: line #$line"
else
echo "$1" >> "$2"
- echo " - Added"
+ echo " + Added"
fi
echo
}