如果第一个值等于1则接收回声

时间:2015-09-29 10:48:32

标签: bash shell if-statement terminal

在bash脚本中,我读取文件aa001并返回第一个值。当第一个值等于1时,在终端上返回ok之类的消息

#!/bin/bash  
varReprise=`head -n 1 aa001`
echo $varReprise
un=1
if [`$varReprise` = `$un`]
 then
   echo " OK "
else 
   echo "not Ok"
fi

但是当我运行脚本时出现以下错误:

./test: ligne 5: 1 : command not found 
./test: ligne 5: [: « ] » command not found 

0 个答案:

没有答案