Hey!
I am trying to find the output of the piece of code below:
Quote:
x=10 y=15
if [ $x % 2 -eq $y % 3 ]
then
echo "\n Barnie "
fi
|
But every time I run, it generates an error:
line 4: [: too many arguments
I don't understand the error.
When I modified it a little :
Quote:
x=10 y=15
if [ ( $x % 2 ) -eq ( $y % 3) ]
then
echo "\n Barnie "
fi
|
ie I covered the expression inside if with () brackets
then also an error is shown
line 5: syntax error near unexpected token `$x'
line 5: `if [ ( $x % 2 ) -eq ( $y % 3 ) ]'
Is there a limitation to the arguments inside test ([) command ??
Please help!