I have a bash script where I use ssh to connect to another server and run some commands there. I found some sites that the error (Warning: no access to tty (Bad file descriptor).Thus no job control in this shell.) is a friendly message but my bash script gets stuck. No other commands are executed after this message appears. Other forums said to use ssh -t to suppress the message but its not working for me. My code looks something like this:...stty -echosshpass pwd ssh -o StrictHostKeyChecking=no usr@1.1.1.1 'su -lc rm -rf tmp' 2>/dev/nullstty echo...The reason why I'm using stty-echo is because I need to switch users to root and the password is displayed on the terminal (which I don't want). I get the error message (Warning: no access to tty (Bad file descriptor). Thus no job control in this shell.) after I enter the password for root on the connect server (ip: 1.1.1.1). Any suggestions? Let me know if further explanation is required. Thanks!(My version of bash is GNU bash version 3.2.51(1))EDITThe error message I get when removing 2>/dev/null is:Warning: no access to tty (Bad file descriptor).Thus no job control in this shell. stty: standard input: Invalid argument
I want to suppress no access to tty error message?
bash;shell;ssh