linux - 如何在 Linux 中到处运行脚本

标签 linux bash

我在 /home/campus27/zwang10/bin 中有一个脚本 HOST_AVAI.sh。在我的 .bashrc 中,我添加了 export PATH=$PATH:/home/zwang10/bin/HOST_AVAI.sh。但是在我键入 HOST_AVAI.sh 后,它显示 HOST_AVAI.sh: Command not found.。 有人可以帮我吗?

已添加

$ echo $SHELL
/bin/tcsh

最佳答案

您的路径应该是 PATH=$PATH:/home/zwang10/bin 并将其添加到 .bash_profile 中。在此之后使用以下命令运行脚本:

$ . .bash_profile

确保您的HOST_AVAI.sh 必须具有执行权限。

$ cd  /home/zwang10/bin
$ chmod +x HOST_AVAI.sh

现在从任何地方运行这个命令。

关于linux - 如何在 Linux 中到处运行脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36784327/

相关文章:

Bash One Liner : copy template_*. txt 到 foo_*.txt?

c++ - xubuntu 21.10 g++ gtk4 "error: ‘gtk_container_add’ 未在此范围内声明”

python - 为什么远程部署路径中的 $PATH 与远程系统中的 $PATH 不同?

linux - 注释行出现错误 "0: command not found"

python - 如何修改 STDOUT?

linux - 将人类可读的时间范围转换为相关的秒数

c# - Mono C# 应用程序使用 boost 组件实例化 C++ 库类

linux - 使用 perl 确定 IPv4 数据包的源端口

linux - 辅助数据 : ‘IP_RECVIF’ undeclared (first use in this function)

java - 如何从 Java 启动交互式命令行界面程序?