linux - 为什么找不到我的命令但在命令行中有效?

标签 linux bash shell path

这是我脚本的一部分:

read -p "[q] What is the meteor project's location? "
PATH=$REPLY
cd $PATH
cd src
echo $(pwd)
mrt bundle bundle.tar.gz

它打印出正确的工作目录。在控制台中输入 mrt bundle bundle.tar.gz 即可。 执行我的脚本,我得到 meteor_bundle.sh: line 9: bash: command not found。可能是什么原因?

最佳答案

你选错了变量名:PATH在Bash中有特殊的含义:它用来指示Bash去哪里寻找可执行程序。选择另一个名称(最好是小写,请参阅@Gordon 的评论),应该没问题。

关于linux - 为什么找不到我的命令但在命令行中有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21062833/

相关文章:

PHP/C++ : shm_open() error when sharing memory

linux - 如何向已使用的用户名添加递增数字

bash - shell脚本: running cmd that was passed into a function

windows - 如何仅使用键盘从 bash 复制粘贴到 vim,反之亦然?

bash - 可以通过CLI在Linux中使音频静音的脚本有效,但需要帮助

python - 为什么我每次打开新终端时都必须返回 "source vitrualenvwrapper.sh"?

linux - 在linux中安装rpm包时如何自动填充用户输入?

php - Bash 和 PHP - 在一定时间后调用函数/命令

linux - 删除文件中模式之间所有出现的某些字符

linux - 如何在不使用引号的情况下删除名为 *(星号)的文件?