mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-21 20:35:11 +00:00
[install] Join line numbers when multiple matches found
This commit is contained in:
parent
829c7f909c
commit
4ee85f11e8
8
install
8
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user