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!