STRING1 != STRING2 (conditional operator)

true if the strings are not equal.

Integers are compared with -ne.

Bash

This operator uses pattern matching within a [[ ... ]] construct.

Examples

Different ways to test if two strings are not equal:
1
2
3
4
test "$name" != "Jane" && echo "it's not Jane!"
[ "$name" != "Jane" ] && echo "it's not Jane!"
# Bash
[[ "$name" != "Jane" ]] && echo "it's not Jane!"
BashSupport Pro ist eine Bash IDE mit Unterstützung für !=probieren Sie es aus!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches