Hello there
Been using Unix bash scripting for two days now so am very new to this. I am currently doing a project now and i'm basically making a noughts and crosses game (or tic tac toe).
I have created the board using an array. When I try and check to see if the array is empty using an If function it says integer expression expected.
the code is as follows
if eval [ \$board$col1[$row1] - eq 1 ]
the 1 represents the empty space.
Cheers for any help
There shoule not be space between - and eq.
Woops copying error, there is a not a space between. Thanks though
---------- Post updated at 10:35 AM ---------- Previous update was at 10:33 AM ----------
I just done an echo test and its returning 1[3] if i input A 1 for example.
---------- Post updated at 10:59 AM ---------- Previous update was at 10:35 AM ----------
Right just sorted it, the line should be
if eval [ /${board%col1[row1]} -eq 1 ]
is it working fine now? if not post your code and highlight where you are struggling.
ps: if your having problems with eval commands try replacing it with normal array commands.