Sorting and Comparing Strings
Inside [[ ]] use < and > for alphabetical order and == for equality, with quotes.
Example
[[ "apple" < "banana" ]] && echo "apple first"
[[ "a" == "a" ]] && echo "equal"
[[ "abc" != "abd" ]] && echo "different"Result
apple first equal different
Exercise
Not equal strings.
[[ a b ]]
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.