Automate the response to command prompt in matlab
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I am using system command([status,cmdout] = system(command,'-echo')) in matlab to access my linux kernel command prompt to execute a command. After the execution of the command in matlab, the matlab command prompt ask me to enter the system password which is the user password. In this case I need to manually type the password in the matlab command prompt to take the code execution further. During this time the whole matlab code execution pauses till I finish typing my password on the command prompt and press enter.
I would just like to know, is there a way where I can keep the password text in matlab window and after the command executes, the password text gets automatically typed in the matlab command prompt from the matlab window. I just want the code execution flow to be continuous on one click of the run button. I do not want to manually enter the password on the command prompt.
Thank you
댓글 수: 0
답변 (1개)
Fangjun Jiang
2021년 4월 28일
There is a more secure way to do this such as using PuTTY PLINK.But if you don't mind storing and exposing your password, you could type in and save your password in a .txt file and run
system('MyCommand < Password.txt')
댓글 수: 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!