Running `expect` from inside AppleScript
Running `expect` from inside AppleScript
- Subject: Running `expect` from inside AppleScript
- From: Jenni via AppleScript-Users <email@hidden>
- Date: Wed, 8 Dec 2021 10:11:33 -0800
I'm trying to combine multiple scripts into a single AppleScript but
I'm running into problems. Everything here works perfectly when called in an
external bash script, but not as written below. I'm guessing it's a quoting
issue, though I just don't see it. It's giving me errors like:
Error Number: 1
Terminal got an error: couldn't read file "
sleep 1
send ******** <-- my password
expect *root@server:*
interact
": no such file or directory
How can I get this to work as a standalone AppleScript? It would be
nice to have everything in one file, since it's so short.
Thanks,
Marc
set _username to "root"
if application "FileMaker Pro 18 Advanced" is not running then
tell application "FileMaker Pro 18 Advanced" to activate
delay 9
end if
try
tell application "FileMaker Pro 18 Advanced"
open "/Users/work/Filemaker/passwords.fmp12"
show (every record of current table whose cell "username" =
_username)
set _password to get data cell "password" of current record
end tell
end try
tell application "Terminal"
tell application "System Events" to keystroke "n" using {command down}
do shell script "/usr/bin/expect -c \"
## Variables ##
set force_conservative 1
set timeout 9
## Login ##
spawn ssh email@hidden
expect \"password: \"
sleep 1
send \"" & _password & linefeed & "\"
expect \"*root@server:*\"
interact
\""
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden