In linux, in shell scripts, conditions for if statement can be checked using the test command, as below
if test 4 -gt 2; then
echo "4 is bigger than 2"
fi
But there is a more syntatically elegent/common way to write the above, what is it? And think of the real point behind this buboflash question!
if [ 4 -gt 2 ]; then
echo "4 is bigger than 2"
fi
^^ really what this question is demonstrating is that the if statement has as its condition, just some command that either returns success (0) or fail (non-zero) error code and that determines whether the if clause is executed! And the "[ ]" syntax is just a better looking replacement for the test command!
In linux, in shell scripts, conditions for if statement can be checked using the test command, as below
if test 4 -gt 2; then
echo "4 is bigger than 2"
fi
But there is a more syntatically elegent/common way to write the above, what is it? And think of the real point behind this buboflash question!
In linux, in shell scripts, conditions for if statement can be checked using the test command, as below
if test 4 -gt 2; then
echo "4 is bigger than 2"
fi
But there is a more syntatically elegent/common way to write the above, what is it? And think of the real point behind this buboflash question!
if [ 4 -gt 2 ]; then
echo "4 is bigger than 2"
fi
^^ really what this question is demonstrating is that the if statement has as its condition, just some command that either returns success (0) or fail (non-zero) error code and that determines whether the if clause is executed! And the "[ ]" syntax is just a better looking replacement for the test command!
status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|
repetition number in this series | 0 | memorised on | scheduled repetition | ||||
scheduled repetition interval | last repetition or drill |