本文介绍了庆典:非法数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行这个bash脚本:

When I run this bash script :

if [ [$EUID -ne 0] ]; then
   echo "This script must be run as root" 1>&2
   exit 1
else

printf " whathever "

exit 0
fi

我有这样的错误:

I have this error :

./myScript: 15: [: Illegal number: [

你看不出什么问题?

Do you see any problem ?

推荐答案

您有语法错误在你,如果条件下,使用if条件:

You have syntax error in your if condition, use this if condition:

if [ "$EUID" -ne 0 ];

或使用 []]

if [[ "$EUID" -ne 0 ]];

这篇关于庆典:非法数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 19:08
查看更多