Simple bash script; what's wrong with this syntax?

前端 未结 3 1473
后悔当初
后悔当初 2021-01-24 08:51

I\'m reading bash script tutorials and this seems like it should work, but I clearly am missing something:

isframecount=0
framecount=0
while read p; do
  if [\"$         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-24 09:31

    Two issues:

    Issue 1:

    You need to have spaces in test operator. Change the following line:

    if ["$isframecount" -eq 0]
    

    to

    if [ "$isframecount" -eq 0 ]
    

    Issue 2:

    $isframecount = 1

    There should be no $ sign before variable and no spaces in the assignment operator

    Change it to isframecount=1

提交回复
热议问题