if [“$i” -gt “$count”]; IS GIVING AN ERROR

后端 未结 1 1601
有刺的猬
有刺的猬 2021-01-26 12:40

I\'m trying to put the \'f-$count\'(f-1,f-2) name into the array.

Below is the code,

echo \"Enter the count\"
read count
echo $count

#arr=()
i=1
while t         


        
相关标签:
1条回答
  • 2021-01-26 13:09

    In shell programming, the brackets in the if MUST be delimited by spaces:

    if ["$i" -gt "$count"]; then
    

    MUST be:

    if [ "$i" -gt "$count" ]; then
    

    [EDIT] The left bracket ([) is actually a built-in shell command and so requires the space afterwards to delimit it from its parameters, as with any command.

    0 讨论(0)
提交回复
热议问题