-h FILE (conditional operator)

true if the file is a symbolic link. false if the file does not exist or is not a symbolic link.

-L is an alias of -h.

Examples

Different ways to test if a file is a symbolic link:
1
2
3
4
test -h /bin/sh && echo "symbolic link"
[ -h /bin/sh ] && echo "symbolic link"
# Bash
[[ -h /bin/sh ]] && echo "symbolic link"
BashSupport Pro ist eine Bash IDE mit Unterstützung für -h – probieren Sie es aus!
© 2020–2022 Joachim Ansorg
Impressum
Datenschutz
Rechtliches