Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 158

Expect script error- extra characters after close-quote

$
0
0

Error while executing send if command, Not sure if I'm missing some tcl syntax.

#!/usr/bin/expect -f# Get the list of hosts, one per line #####set f [open "/tmp/host.txt"]set hosts [read $f]close $f# Iterate over the hostsforeach host $hosts {spawn ssh $hostexpect "password: "send "abcd@123\r"expect "$ "send "if [ `df -Ph / | grep -vE '^Filesystem' | awk '{ print $5 "" $1 }' |cut -d'%' -f1` -ge 60 ] ;then  echo "Hi Team- Please check root file system space on `hostname` " | mailx -s "Alert: Almost out of disk space on `hostname`" zoom@oracle.com ;fi\r"expect "$ "send "exit\r"expect eof     }

===Error===

[root@hzavks01~]# extra characters after close-quote    while executing"send "if [ `df -Ph / | grep -vE '^Filesystem' | awk '{ print $5 "" $1 }' |cut -d'%' -f1` -ge 60 ] ;then  echo "Hi Team- Please check root file system..."    ("foreach" body line 6)    invoked from within"foreach host $hosts {spawn ssh $hostexpect "password: "send "abcd@123\r"expect "$ "send "if [ `df -Ph / | grep -vE '^Filesystem' | awk '{ print $5..."    (file "./test.sh" line 10)

Viewing all articles
Browse latest Browse all 158

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>