Bash: stty: standard input: Inappropriate ioctl for device when SSH

3.3k views Asked by At

I'm writing and simple bash script:

#! /bin/bash
echo "IP: $1"
sshpass -p 'pass' ssh -t -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$1 << EOF
    cd ../
    sed -i -e 's/x=false/x=true/g' file.txt
    echo "*** x has changed! ***"
    cat file.txt
EOF

I run the script like this:

bash test.sh ip (I enter some server IP).

The script works but I get this message in the terminal:

IP: ip
stty: standard input: Inappropriate ioctl for device
*** x has changed! ***
x = true

Why does the stty message appear? what does it mean and how can I make it disappear? (I try some suggestions that I found on web, but nothing helped).

Thanks!

1

There are 1 answers

0
Philippe On

Add bash to avoid loading initialization files :

sshpass -p 'pass' ssh -T -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$1 bash << EOF

You don't seem to need -t, so use -T