Multiple choice technology operating systems

How would you check f two strings are equal?

  1. a. test $a –eq $b
  2. b. test $a –equal $b
  3. c. test $a = $b
  4. d. sh –c test $a == $b
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In shell scripting, to check if two strings are equal, use 'test $a = $b' or its equivalent '[ $a = $b ]'. The -eq operator is for integer comparison, and -equal is not a valid test operator. The == operator works in bash but = is POSIX-compliant.