"No such variable" in Expect scripts
"jim car" <[email protected]>
| Newsgroups | gmane.linux.redhat.release.psyche |
|---|---|
| Message-ID | <[email protected]> |
I am curious if anyone knows how to get this to work.
Example.
linenum=`grep -n /home/abc.com /etc/httpd/conf/httpd.conf | awk -F: '{print
$1;exit}'`
On the command line it always works, but in an expect script it always
errors out stating that the $1 is not a variable.
can't read "1": no such variable
while executing
"send -- "linenum=`grep -n /home/$domain /etc/httpd/conf/httpd.conf | awk
-F: '{print $1;exit}'`\r""
(file "./rmdomain.exp" line 43)
I think the following id the same problem. I'm trying to get the $timestamp
variable to be used when backing up the configuration files prior to
changing them, but it gives the same type of error message from the
following code.
send -- "timestamp=`date +%Y%m%d%H%M%S`\r"
expect -exact "\[root@cgi root\]# "
send -- "cp /etc/vsftpuser.chroot_list
/etc/backup/vsftpuser.chroot_list$timestamp\r"
expect -exact "\[root@cgi root\]# "
Also, the expect script slows down half way thru. I do have "sleep 1"
commands in it to make sure that the passwd command doesn't get over run,
but not the rest of it because they are straight commands like grep, cat,
cp, etc.
Any help would be appreciated.
Jim
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
--
Psyche-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/psyche-list