gpt4 book ai didi

linux - 当我在 ubuntu 终端中运行程序时,如何摆脱 "./"?

转载 作者:太空宇宙 更新时间:2023-11-04 11:05:28 25 4
gpt4 key购买 nike

我听说我需要在 .profile.bashrc 中编辑我的路径。

例如,不必像 "./a.out" 那样运行脚本或 c++ 程序 的输出,我只想能够输入 "a.out"?

最佳答案

您的程序需要位于搜索路径中指定的路径之一。

如果您的程序位于 my_directory 中,那么您:

export PATH=$PATH:my_directory

这可以添加到您的 .profile/.bashrc

将可执行文件放在标准 Unix 文件夹中通常是有意义的,例如 /usr/local/bin(已经在 $PATH 中)

注意:

关于linux - 当我在 ubuntu 终端中运行程序时,如何摆脱 "./"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25449950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com