As a very confused newbie, what's up with the IF statement and [ ], [[ ]], ( ), (( ))
why is
if [ $jengnr -eq 1 ]; then
correct, but here it's double:
if [[ -f "$jdir$object.eng.dat" ]]; then
and then I read that a nested if inside an if should be (( )) (not my code)
#!/bin/bash
# Nested if statements
if [ $1 -gt 100 ]
then
echo Hey that\'s a large number.
if (( $1 % 2 == 0 ))
then
echo And is also an even number.
fi
fi
but I used [[ ]] in an if statement that was inside an if [[ ]] statement, and that worked to?
Can somebody please explain what, who and why there are 4 different if?
.. and when to use them correctly?
bash
? ... runman bash
in a console – jsotola Aug 11 '20 at 19:15