🎴 Flashcard Mode

Linux Operating Systems Fundamentals

Card1 / 20
Mastered0
Review0
QuestionClick to flip

How would you check f two strings are equal?

AnswerClick to flip back
A
c. test $a = $b
💡 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.

Change Mode