🎴 Flashcard Mode
Programming Languages Quiz
Card1 / 20
Mastered0
Review0
QuestionClick to flip
Following test option may be used to check whether the stdin in a given script is a terminal
AnswerClick to flip back
A
[ -t 0 ]
💡 Explanation:
In Bash, the -t test operator checks if a file descriptor is opened on a terminal. File descriptor 0 represents standard input (stdin). Therefore, [ -t 0 ] correctly checks if stdin is a terminal. Option [ -t 1 ] checks stdout, while -T is not a valid test operator for this purpose.