"No such variable" in Expect scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxx root\]# "
send -- "cp /etc/vsftpuser.chroot_list /etc/backup/vsftpuser.chroot_list$timestamp\r"
expect -exact "\[root@xxx 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 Psyche-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux