You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
490 B
23 lines
490 B
#!/bin/bash |
|
|
|
|
|
has=$(cat ~/.bashrc | egrep "^# ADDED BY npm FOR NVM$" || true) |
|
if [ "x$has" == "x" ]; then |
|
echo "doesn't have it, exiting" |
|
exit 0 |
|
fi |
|
tmp=~/.bashrc.tmp |
|
cat ~/.bashrc | { |
|
incode=0 |
|
while read line; do |
|
if [ "$line" == "# ADDED BY npm FOR NVM" ]; then |
|
incode=1 |
|
elif [ "$line" == "# END ADDED BY npm FOR NVM" ] \ |
|
&& [ $incode -eq 1 ]; then |
|
incode=0 |
|
elif [ $incode -eq 0 ]; then |
|
echo "$line" >> $tmp |
|
fi |
|
done |
|
} |
|
mv $tmp ~/.bashrc
|
|
|