可执行文件任意位置执行

原文地址:https://www.cnblogs.com/liqinglucky/p/bin.html
通常我们自己编译的可执行文件都是./执行。如果想做成系统任意目录可见,就可以将可执行文件拷贝到系统目录/usr/local/bin/

  1. 将自己的bin文件拷贝到系统目录。
# cp test-bin-1.0.2 /usr/local/bin/
# ls /usr/local/bin/
test-bin-1.0.2
  1. 测试可执行文件任意目录可见。
# test-bin-1.0.2
Version: 1.0.2

shell脚本也是同样道理。将shell脚本做成任意目录可执行

# cp test.sh /usr/local/bin/

参考:
https://www.cnblogs.com/fkaka/p/15950013.html

posted @ 2023-11-24 10:49  liqinglucky  阅读(35)  评论(0编辑  收藏  举报