0

I need to recover a file from a REST request, this request asks for my password, but I need it to be automatic, so I'm using an expect script in order to enter my password without need for human interaction. My problem is that I don't know how to get the file after the password is sent.

Here's the expect script :

#!/usr/bin/expect

set password [lindex $argv 0]

spawn [lindex $argv 1] {*}[lrange $argv 2 end]
expect "Enter host password for user \'*\':*" {send "$password\r"; interact}

And here's the call to the script :

./pgbExpectLog.sh $password curl -Lu $adobeId https://build.phonegap.com/api/v1/apps/$appId/ios

I need to catch the data that follows the sending of my password and redirect it into a file, I can't do a simple redirection ('>') in my bash script because I would get the "spawn [command]" and "Enter password:" lines with a bit of corrupted data, so I need to log into the expect script, but I don't know where and how.

Aserre
  • 4,916
  • 5
  • 33
  • 56
Xobtah
  • 464
  • 7
  • 20

1 Answers1

0

Try curl's -o <outfile> option:

curl -o file -Lu $adobeId https://build.phonegap.com/api/v1/apps/$appId/ios
pynexj
  • 19,215
  • 5
  • 38
  • 56