0

I am trying to do something basic using expect:

#!/usr/bin/expect -f

# define location variable; will be numeric eg 1234321
v_dir=$(cat /tmp/patch.txt)

spawn sftp [email protected]@server.company.com 
expect "password :"
send "Chu6!0ck\r"
expect "patch"
send "cd $v_dir\r"
interact

Basically, I am trying to automate getting a patch from a remote patch server. The patch number is derived from a calling script - now I need expect to read that variable and cd to it.

0

1 Answer 1

1

The short answer is to use Expect syntax in an Expect program.

set v_dir [exec cat /tmp/patch.txt]
Sign up to request clarification or add additional context in comments.

2 Comments

Sure. Calling out to cat isn't going to be a huge hit though.
set v_dir [exec cat /tmp/patch.txt] worked, so thank you !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.