chef-lctp/script/fix_stdin_error.sh

11 lines
286 B
Bash
Raw Normal View History

# If last line is `mesg n`, replace with conditional.
if [ "`tail -1 /root/.profile`" = "mesg n" ]; then
echo 'Patching basebox to prevent future `stdin: is not a tty` errors...'
sed -i '$d' /root/.profile
cat << 'EOH' >> /root/.profile
if `tty -s`; then
mesg n
fi
EOH
fi