-t FD (conditional operator)

true if FD is a file descriptor, which is opened on a terminal.

Examples

Different ways to test if a file descriptor is opened on a terminal:
1
2
3
4
test -t 1 && echo "stdout opened on terminal"
[ -t 1 ] && echo "stdout opened on terminal"
# Bash
[[ -t 1 ]] && echo "stdout opened on terminal"
BashSupport Pro 是一个 支持 -t 的 Bash 集成开发工具 – 马上试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款