LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

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


doesn't like:

//*********************

#!/usr/bin/expect -f
#!/bin/sh


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 backup@www.steve.com du -sk /Volumes/extdrive1/serverBackups/backup.$HOSTNAME.$DATE.tar|cut -f1|tr -d A-Z " "
expect -re "backup@www.steve.com's password:"
send "*****\r"

catch {set $SIZE2}

interact

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

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
wedgeworth
Member
 
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]
or
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
wedgeworth
Member
 
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.
 
  


Reply


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


All times are GMT -5. The time now is 02:18 AM.

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