Why is Bash producing two different outputs for these two commands:
$ echo $(tput cols 2>/dev/null)
80
$ echo $(tput cols)
141
PS. Widen your terminal to have more than 80 columns (most shells default to 80).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It appears to be because both stdout and stderr have been redirected, so
tputdoesn’t know what terminal you want the info for.Note that in your example, stdout is redirected implicitly by
$().