Skip to content

Commit cee9034

Browse files
committed
I didn't know about 'sed -i', makes this a lot easier.
1 parent b7380d8 commit cee9034

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

virtualenvwrapper_bashrc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,11 @@ function add2virtualenv () {
393393
echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2
394394
fi
395395

396-
contents=$(cat "$path_file")
397396
if [ $remove -eq 1 ]
398397
then
399-
echo "$contents" | sed "\:^$absolute_path$: d" > "$path_file"
398+
sed -i "\:^$absolute_path$: d" "$path_file"
400399
else
401-
echo "$contents" | sed "1a $absolute_path" > "$path_file"
400+
sed -i "1a $absolute_path" "$path_file"
402401
fi
403402
done
404403
return 0

0 commit comments

Comments
 (0)