How can i run the bash shell script in matlab

118 ビュー (過去 30 日間)
Farik John
Farik John 2016 年 1 月 29 日
回答済み: DanielFromIllinois 2022 年 3 月 14 日
I have the bash file in where there is something like below.
#!/bin/bash
wget http://www.vlfeat.org/sandbox-matconvnet/models/imagenet-vgg-verydeep-16.mat \
--output-document=data/imagenet-vgg-verydeep-16.mat --continue
How can i run this script file?

回答 (2 件)

Geoff Hayes
Geoff Hayes 2016 年 1 月 29 日
  6 件のコメント
Farik John
Farik John 2016 年 2 月 2 日
Thanks Geoff and Walter. I managed to find the right command to run it as below. system('c:\cygwin64\bin\bash "d:\MyProject\download.sh"');
PRAVALLIKA PEDDAMALLU
PRAVALLIKA PEDDAMALLU 2022 年 1 月 27 日
Hi @Farik John, I'm trying to run shell script from matlab in windows. When I use system('D:\MyProject\download.sh'); command, it is directing to the shell script file in notepad++ rather than running the commands.
I tried using "system('c:\cygwin64\bin\bash "d:\MyProject\download.sh"');" but this is throwing error saying "Not a directory". Please let me know how can we run shell script from matlab.
I value your input. Thanks in advance.

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


DanielFromIllinois
DanielFromIllinois 2022 年 3 月 14 日
If you're running this from Windows (not mac or linux) I got this to work by doing:
system('C:\Apps\Git\git-bash.exe Something.sh')
The above assumes that Something.sh is in your current directory within MATLAB. You could provide an absolute path like:
system('C:\Apps\Git\git-bash.exe C:\Users\UserName\home\scripts\Something.sh')

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by