execute Linux script with expect
6 ビュー (過去 30 日間)
古いコメントを表示
Matlab R2015a
Hello,
In order to programmatically ssh connect I made an expect script as explained in
https://stackoverflow.com/questions/45129323/ssh-connect-and-commands-programmatically
#!/usr/bin/expect
set login "any_user"
set addr "some_address"
set pw "any_pwd"
spawn ssh -t $login@$addr
expect "$login@$addr\'s password:"
send "$pw\r"
expect "~" ; # put here string from your server prompt
send "mkdir some_dir\r"
interact
I called this script LoginSSH.sh (of course, with my own data), then I run this command in the Linux console without problems:
./LoginSSH.sh
The idea was to run this command from Matlab with system():
scmd='./LoginSSH.sh'
[status,cmdout]=system(scmd)
But for some reason Matlab has some problems to execute the script via system(). This is the output:
status =
1
cmdout =
OpenSSL version mismatch. Built against 100020af, you have 1000107f
send: spawn id exp4 not open
while executing
"send "$pw\r""
(file "./LoginSSH.sh" line 8)
I can even run the command in Python:
import os
from subprocess import call
call(["./LoginSSH.sh"])
again, without any problems.
What could be the reason Matlab won't like to run the shell script?
Thanks in advance.
jleon
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!