Mailing List
Home
Forum Home
Linux - General Red Hat Linux discussion list
Enterprise Linux 3 - Discussion of Red Hat Enterprise Linux 3 (Taroon)
Installation - Getting started with Red Hat Linux
Red Hat Linux 9 - Discussion of Red Hat Linux 9 (Shrike)
Red Hat Linux 7.3 - Discussion of Red Hat Linux 7.3 (Valhalla)
Red Hat Linux 7.2 - Discussion of Red Hat Linux 7.2 (Enigma)
Apache Web Server
Oracle database, Microsoft SQL server ...
Subjects
application/x mplayer2 plugin
RPM error: db4 error(16) from dbenv >remove: Device or resource
   busy
Command stream end of file while reading
X Windows problem (xauth)
Upgrading openoffice 1 1 rpm
FTP: connection refused
FTP: connection refused
mount: /dev/cdrom: is not a valid block device
Dell Precision 650, RedHat 9, no sound
how to trace the cause resulting in the crash of bind server
Virus on the list
UNINSTALL RPM MYSQL
usb pen drives: mounting as a user
broadcom network interface
make mrproper
sendmail configuration on redhat
Couldn 't open PID file /var/run/named/named pid Permission denied
Promise 378 controller
kernel 2 6 and /dev/sound/mixer not found
Problem using up2date
mrtg step by step howto/configuration for a newbie?
Compiling and Installing Kernel 2 6
Can 't locate module ppp0, can 't locate module ppp compress 21
HOW I CAN MAKE BOOTABLE FLOPPY DISKET
Lotus Notes under Wine
/etc/security/limits conf question
Intel E/1000 driver
Command stream end of file while reading
rpm database corrupt
qla2300 modules
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
"No such variable " in Expect scripts

"No such variable " in Expect scripts

2003-07-29       - By jim car

 Back
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@(protected) root\]# "
send -- "cp /etc/vsftpuser.chroot_list
/etc/backup/vsftpuser.chroot_list$timestamp\r"
expect -exact "\[root@(protected) 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




Earn $52 per hosting referral at Lunarpages.