Execute a bash script from Matlab

1 view (last 30 days)
Matthew
Matthew on 4 Jun 2012
Hi, thanks in advance for the guidance.....
Running Matlab 2011b on Win 7 machine.
I want to execute a bash script within Matlab. I know from Cygwin, etc I can call it like this: ./ecs_dir.sh folder_1 folder_2
And from a search of the Matlab archives, I found the following guidance on executing bash scripts: "! sh scriptname.sh" (see: http://www.mathworks.com/matlabcentral/newsreader/view_thread/293334)
But when I try this, i am given an error message: 'sh' is not recognized as an internal or external command, operable program or batch file.
How do I properly call this?
Thanks, Matt

Answers (1)

Walter Roberson
Walter Roberson on 4 Jun 2012
The information about !sh is only for Unix systems.
Unless you start MATLAB from within Cygwin, etc., your command like would have to look something similar to
!cygwin.exe ecs_dir.sh folder_1 folder_2
I could be wrong on the details, as I have not used cygwin for a number of years.
Windows 7 does not have its own bash.

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!