我正在试验
Linux共享库,并在$LD_LIBRARY_PATH中添加了一个条目(导出LD_LIBRARY_PATH = / path / to / library:${LD_LIBRARY_PATH}).现在我希望它消失了.我怎样才能做到这一点?
PS.在添加条目之前键入echo $LD_LIBRARY_PATH给了我一个空行.现在它说:
path/to/library:
解决方法
如果以前它给你空行(它很可能)意味着没有设置变量(默认情况下它没有设置),所以你可以取消它:
unset LD_LIBRARY_PATH
其他一些实验选择:
export MY_PATH=/my/path export MY_PATH2=/my/path2 export LD_LIBRARY_PATH="${MY_PATH}:${MY_PATH2}" echo $LD_LIBRARY_PATH /my/path:/my/path2
从末尾删除路径:
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH/:${MY_PATH2}/}" echo $LD_LIBRARY_PATH /my/path
类似地,从头开始删除路径(如果设置如上):
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH/${MY_PATH}:/}"