LD_LIBRARY_PATH环境变量可以用于设置Linux动态库的位置,常见的用法如export LD_LIBRARY_PATH=/home/username/foo:$LD_LIBRARY_PATH[1],但是每次都输入一长串的路径多少有些麻烦,用shell来执行是不错的方式。

首先将export命令保存至export.sh文件,然后将文件修改为可执行权限,最后运行 source export.sh[2]即可。由于子shell对变量的修改无法影响到父shell,因此需要采用source或者.执行,而不是直接运行./export.sh[2]。

 

[1]Shared libraries with GCC on Linux - Cprogramming.com

[2]shell - How can I make variables "exported" in a bash script stick around? - Unix & Linux Stack Exchange

相关文章:

  • 2021-12-29
  • 2022-12-23
  • 2021-08-21
  • 2021-08-23
  • 2022-12-23
  • 2021-04-20
  • 2021-11-23
猜你喜欢
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案