Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-01-2003, 05:08 PM   #1
Registered: Aug 2003
Posts: 234

Rep: Reputation: 30
expect scripting syntax problems...(catch, echo,....)

doesn't like:


#!/usr/bin/expect -f

set HOSTNAME bob
set BPATH /usr/var/backups
#set BPATH /etc/backup

#set DATE date +%m-%d-%y
set DATE [exec date +%m-%d-%y]

cd $BPATH/

set SIZE [exec du -sk backup.$HOSTNAME.$DATE.tar]

spawn ssh du -sk /Volumes/extdrive1/serverBackups/backup.$HOSTNAME.$DATE.tar|cut -f1|tr -d A-Z " "
expect -re "'s password:"
send "*****\r"

catch {set $SIZE2}


if [$SIZE -ne $SIZE2]
#echo "HELLO"

send [echo "$SIZE"]
send [echo "$SIZE2]


doesn't recognize $SIZE2 as being set, therefore my catch statement isn't working correctly. It is suppose to be take the value returned by the ssh statement (aka the filesize) and assign it to SIZE2. I'm probably using the wrong command or have the woring syntax.

I'm also having problems echoing out anything therefor i can't even see what $SIZE has been assigned to. any help with syntax of: my assignments of $SIZE and $SIZE2, and my catch statement, and any other errors you might see. i would appreciate

Last edited by wedgeworth; 10-02-2003 at 10:07 AM.
Old 10-01-2003, 05:08 PM   #2
Registered: Aug 2003
Posts: 234

Original Poster
Rep: Reputation: 30
along with questions posted right above here.....i was wonderiing is there some syntax that helps execute regular bash commands that are usually used under a normal bash script? i know i've asked about echo (see post right above here) is there some syntax in expect that is used alot surrounding regular bash commands?

something like:

exec [regular bash command]
send [regular bash command]

please if you can help me out on this question, and especially the above questions....i would appreciate.
Old 10-02-2003, 10:24 AM   #3
Registered: Aug 2003
Posts: 234

Original Poster
Rep: Reputation: 30
ok so i'm thinking catch might not be the command i want to use. so the question is still how to acquire the output returned by the du command being preformed during my ssh to the remote host?

i also still don't know how to check the variables to see if assigned correctly. i'm afraid i'm not assigning SIZE correctly. i know i'm not assigning SIZE2 correctly. and echo doesn't work direclty with expect. how do i "echo" out result to make sure they are working?

Last edited by wedgeworth; 10-02-2003 at 10:26 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Scripting - echo command question gbhil Programming 2 04-27-2005 08:27 PM
[Expect scripting] send problem ldp Programming 1 01-24-2005 03:39 PM
CGI script problem: Send/Expect command echo on webpage rajatgarg Programming 2 07-11-2004 05:38 PM
expect scripting Deltron3030 Linux - Newbie 2 12-16-2003 02:56 PM
problems with scripting in expect wedgeworth Linux - Software 1 10-07-2003 04:34 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration