expect에서 echo로 추가할 때
expect -re "root@"
send "echo '' >> /etc/hosts\r"
send "echo 'xxx.xxx.xxx xxxx.xxx.xxx xxxxxx01' >> /etc/hosts\r"
특정 문자열 삭제
send "sed -i '/xxx.xxx.xxx/d' /etc/hosts\r"
cdf 다음 라인에 "xxx.xxx.xxx.xxx abc.abc.com abc "추가
send "sed -i '/cdf/i\xxx.xxx.xxx.xxx abc.abc.com abc' /etc/hosts\r"
sed -i --follow-symlinks