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 [\"$
if [ "$isframecount" -eq 0 ]
Spaces are required on both sides of the square brackets.
isframecount=1
No dollar sign, no spaces around =
in an assignment statement.
Watch out for spaces where they matters and where there should be not. In this case, if ["$isframecount" -eq 0]
should be if [ "$isframecount" -eq 0 ]
(see the spaces after [
and before ]
).
The reason for this is that [
is actually the name of a program... See by yourself... Type ls /bin/[
... Now, if there is no space, then bash will look for a program named ["0"
or something similar, which most certainly does not exist in your path.
Then, the opposite situation... There must be no space around the =
in variable assignment. So $isframecount = 1
should be isframecount=1
. Note that I also removed the dollar sign, that's the way to go.
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