Linux的:非法读取选项-a [英] Linux: Illegal option read -a

查看:254
本文介绍了Linux的:非法读取选项-a的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经找到了这个问题的答案......只是想为别人提供一些信息,谁也遇到了这个问题...

I have found the answer for this question... Just want to provide some information for others, who met this problem too...

在我的系统,我得到了这个问题,因为我使用了 SH main.sh 来处理我的shell脚本,而忽略打击和壳牌之间的区别。

In my system, I got this problem because of I used the sh main.sh to process my shell script and ignore the difference between "Bash" and "Shell".

为了解决这个问题,你可以尝试改变模式转换成可执行的,通过使用使用chmod + X ,并使用 ./ 执行程序。

In order to solve this problem, you might try to change the mode into executable, by using chmod +x and using ./ to execute the program.

祝你好运!

推荐答案

错误:

Illegal option read -a

结果显示,因为你想在shell中运行它,其中的 ISN的 -a 选项 T定义。

was shown because you were trying to run it in a shell where the -a option for read isn't defined.

命令搭配chmod + X script.sh 无关,用它做。它只是仅仅给出脚本执行权限。

the command chmod +x script.sh has nothing to do with it. It just merely gives the script execution permission.

您正试图通过在命令来运行的Bourne shell命令sh script.sh 和Bourne shell的不具有阅读 -a 选项。这是一个Bash的功能。

You were trying to run the command in Bourne shell by the command sh script.sh and Bourne shell read doesn't have the -a option for read. It's a Bash feature.

运行./ 不太答案。你可以说,至少有:以 path_to_the_script 运行它,因为不是每一次你的脚本会在当前目录中结束

Running with ./ is not quite an answer. You could say at least : run it with path_to_the_script because not every time your script will end up in the current directory.

您可以用庆典main.sh 运行它,而不是 SH main.sh

You can run it with bash main.sh instead of sh main.sh.

这篇关于Linux的:非法读取选项-a的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆