Skip to content
Myr

[install] Don't touch dotfiles if not requested (#1048)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Lawrence Wu · committed by Junegunn Choi · parent e1582b8 · Browse files · 1 file+8 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−6 removed

  • other:+8 added−6 removed

1 file+8 added−6 removed

modified:install+8 added-6 removed
303 unmodified lines
304 update="$1"305 line="$2"306 file="$3"307 pat="${4:-}"308 lno=""309310 echo "Update $file:"311 echo " - $line"311 [ -f "$file" ] || touch "$file"312 if [ $# -lt 4 ]; then313 lno=$(\grep -nF "$line" "$file" | sed 's/:.*//' | tr '\n' ' ')314 else315 lno=$(\grep -nF "$pat" "$file" | sed 's/:.*//' | tr '\n' ' ')312 if [ -f "$file" ]; then313 if [ $# -lt 4 ]; then314 lno=$(\grep -nF "$line" "$file" | sed 's/:.*//' | tr '\n' ' ')315 else316 lno=$(\grep -nF "$pat" "$file" | sed 's/:.*//' | tr '\n' ' ')317 fi318 fi319 if [ -n "$lno" ]; then320 echo " - Already exists: line #$lno"321 else322 if [ $update -eq 1 ]; then321 echo >> "$file"323 [ -f "$file" ] && echo >> "$file"324 echo "$line" >> "$file"325 echo " + Added"326 else327 echo " ~ Skipped"
51 unmodified lines