MATLAB Answers

Linux system command open a terminal.

28 ビュー (過去 30 日間)
John Scoggin
John Scoggin 2019 年 9 月 18 日
コメント済み: John Scoggin 2019 年 9 月 23 日
When I run the system('command') option it runs the command silently with no open terminal. I was wondering if there was any way to have it run in an open terminal window? Not for user input sakes, but to display information output from a long running process. I know that if I use the [status, output] = system('commoand') it will place the output of the command into output after the command has run. As this is a long process and the information displayed is estimated time remaining a real time display is useful. Any help is appreciated.

  0 件のコメント

サインインしてコメントする。

採用された回答

Kojiro Saito
Kojiro Saito 2019 年 9 月 19 日
In order to display information from the command, just adding '-echo' option to system command is fine.
[stat, cmdOut] = system('XXX', '-echo');
For example, when I have the following shell script.
test.sh
#!/bin/bash
echo 'Start'
sleep 2s
echo '2 second elapsed'
sleep 5s
echo '7 second elapsed'
I can know the prossesing status by calling it with an echo option.
[stat, cmdOut] = system('./test.sh', '-echo')
Here is a result. We can get echo messages ('Start' and 'X second elapesed') in real time.
Start
2 second elapsed
7 second elapsed
stat =
0
cmdOut =
'Start
2 second elapsed
7 second elapsed
'

  1 件のコメント

John Scoggin
John Scoggin 2019 年 9 月 23 日
Worked Great thanks

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by