bash:在:找不到命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12113942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 03:06:49  来源:igfitidea点击:

bash: In: command not found

bashshell

提问by BostonBB

This is the code I am using:

这是我正在使用的代码:

cd /home
if [ -d ${homedir} ]
   then ln -s /etc/cpbackup-exclude.conf ${homedir}/cpbackup-exclude.conf
fi
done 

And now I am getting this error:

现在我收到此错误:

bash: In: command not found

I am trying to create a symlink to cpbackup-excludefor all accounts.

我正在尝试cpbackup-exclude为所有帐户创建一个符号链接。

回答by Peter

You have mistyped ln (LN)as In (IN)or something similar. The correct command is ln, as in "Lima November". The command lnabbreviates from the word "link", which is the primary function of the command.

你打错了ln (LN)asIn (IN)或类似的东西。正确的命令是ln,如“Lima November”。该命令ln是“链接”一词的缩写,它是该命令的主要功能。

回答by squiguy

Use the absolute path:

使用绝对路径:

/usr/bin/ln 

Your ln utility may be here instead.

您的 ln 实用程序可能在此处。

回答by TJ Singleton

It's possible that the $PATH variable is not set correctly during the execution of your script. Try using an absolute path to the ln command. Typically this would be /bin/ln.

$PATH 变量可能在脚本执行期间未正确设置。尝试使用 ln 命令的绝对路径。通常这将是/bin/ln.