How can i run the bash shell script in matlab

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일

0 개 추천

댓글 수: 6

Farik John
Farik John 2016년 2월 1일
편집: Farik John 2016년 2월 1일
As you see. my bash script is unix script. So, system works at there too, without the support of cygwin? And also, It doesn't work. I tried to run the command - system('D:\MyProject\download.sh'); It opens the download.sh in microsoft word. Would you tell me what's wrong?
Tarik - please clarify what you mean by So, system works at there too, without the support of cygwin?. Given what you have said (now), you are running a Windows version of MATLAB but have cygwin installed so that you can use wget (or are you using a Windows version of wget?). Is this the case? Can you execute your script outside of MATLAB (i.e. from a terminal window) and , if so, how do you do so?
Farik John
Farik John 2016년 2월 1일
편집: Farik John 2016년 2월 1일
Following context doesn't configure out my situation? I tried to run the command - system('D:\MyProject\download.sh'); It means i didn't know that i should cygwin by system command. Anyhow, thank you for your information about system command.
For your information: the Raspberry Pi Support Package installer loads in a wget.exe for windows. With that in place you could edit the .sh into a .bat and not have to worry about cygwin
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"');
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일

0 개 추천

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')

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2016년 1월 29일

답변:

2022년 3월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by