mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 12:55:17 +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"
|
echo " - $1"
|
||||||
[ -f "$2" ] || touch "$2"
|
[ -f "$2" ] || touch "$2"
|
||||||
if [ $# -lt 3 ]; then
|
if [ $# -lt 3 ]; then
|
||||||
line=$(\grep -nF "$1" "$2" | sed 's/:.*//')
|
line=$(\grep -nF "$1" "$2" | sed 's/:.*//' | tr '\n' ' ')
|
||||||
else
|
else
|
||||||
line=$(\grep -nF "$3" "$2" | sed 's/:.*//')
|
line=$(\grep -nF "$3" "$2" | sed 's/:.*//' | tr '\n' ' ')
|
||||||
fi
|
fi
|
||||||
if [ -n "$line" ]; then
|
if [ -n "$line" ]; then
|
||||||
echo " - Already exists (line #$line)"
|
echo " - Already exists: line #$line"
|
||||||
else
|
else
|
||||||
echo "$1" >> "$2"
|
echo "$1" >> "$2"
|
||||||
echo " - Added"
|
echo " + Added"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user