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.
24 lines
490 B
24 lines
490 B
14 years ago
|
#!/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
|