STRING1 > STRING2 (conditional operator)

true if string1 sorts after string2 lexicographically.

> is not included in POSIX. Avoid it if you want to stay compatible with POSIX shells.

Integers are compared with -gt.

Bash

This operator uses the current locale for sorting within a [[ ... ]] construct.

Examples

Different ways to test if a string is sorted after another one:
1
2
3
4
test "$input" > " " && echo "not a special char"
[ "$input" > " " ] && echo "not a special char"
# Bash
[[ "$input" > " " ]] && echo "not a special char"
BashSupport Pro ist eine Bash IDE mit Unterstützung für >probieren Sie es aus!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches