How could you check if two strings are equal?
-
test $a -eq $b
-
test a -eq b
-
test $a -equal $b
-
test $a = $b
D
Correct answer
Explanation
The 'test' command (or [) uses = for string equality comparison in shell scripting. Options A and B incorrectly use -eq which is for numeric comparisons. Option C uses -equal which is not valid test syntax. Option D correctly uses = for string comparison.