Как удалить исходные элементы из .bashrc без комментариев? Я хочу, чтобы исходный элемент не работал в файле .bashrc. Конкретный пункт 'source ~ / miniconda3 / bin / activ' в .bashrc. Я не хочу комментировать это, потому что это неудобство. Так что я думаю, есть ли способ сделать это?
No, typically one can't "undo" something that is "sourced", since it directly changes the current environment. The only way to have the changes "undone" is if, somehow, the old environment was stored, so it could be set back to its original values.
For example, if a file foo.env
is sourced (source foo.env
) and it changes PATH
to include $HOME/mystuff/bin/
, then the only way to undo those changes would be for foo.env
to remember what PATH
was originally, e.g., by setting something like OLD_PATH=$PATH
, then you run something that will set everything back to its original values. (Note that this isn't always reliable, and any changes made after sourcing foo.env
would be lost.)
In the case of anaconda (miniconda), which is the command you reference in your .bashrc
, there does happen to be such a program, though. It's invoked by running something like deactivate
or conda deactivate
, which should "undo" the changes to the environment caused by ~/miniconda3/bin/activate
.