I'm trying to add an ip adress on a list of hosts.
when I do this directly on the host it works:
sed i- /apache$/a sshd: 192.168.2.2 : allow' /etc/hosts.allow
But when I do this by script bash it writes in log.txt file:
./hostsallow.sh: line 11: sed -i /apache$/a: No such file or directory
here is the script:
#!/bin/bash set -x for q in `cat itg4` do echo $q &>> log.txt ssh $q -n 'sed -i '/apache$/a sshd: 192.168.2.2 : allow' /etc/hosts.allow' &>> log.txt done
the set -x gives on screen:
Pseudo-terminal will not be allocated because stdin is not a terminal.
Please can you help me?