Machine-translated by Google. Questions are authored in English.
Top

Discussion

In Unix, how do you check that two given strings a and b are equal ?

  • A.test $a -eq $b
  • B.test $a -equal $b
  • C.test $a = $b
  • D.Sh -C test $a = = $b

Answer: C

In Unix, two strings are compared for equality with test $a = $b, which is option C. The test command uses = for string comparison, while -eq is the operator for comparing integers.

The operator -equal does not exist, and "Sh -C test $a == $b" is not the usual form, since == is not accepted by the standard test command and the shell option is -c, not -C. Hence only option C is correct.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.