This is my script and the syntax to run this script is give ip and next will be the file or script you want to perform on remote server
#!/bin/bash
# The private key used to identify this machine
IDENTITY_KEY=/home/adnew.pem
syntax()
{
echo "Syntax: Ec2.sh server_ip scriptFile]"
echo "For example: ./Ec2.sh server_ip scriptFile"
exit 1
}
if [ $# -ne 2 ]
then
echo not enough arguments
syntax
fi
echo "Running script $2 on $1"
ssh -ttq -i $IDENTITY_KEY ec2-user@$1 sudo -i 'bash -s' < $2
exit
exit
echo "Done"
on script file i have give for testing
touch /root/test
ls /root/test
exit
exit
it makes the file but do not show the ls output by giving error
tcgetattr: Inappropriate ioctl for device
exit
what I have to do ??