|
|
Execute Bash script using Cygwin
Hello, I am trying to execute a bash script in Windows through the 'unix' command via Cygwin. Basically, with Cygwin installed, I can use the 'unix' command to execute unix commands (grep, find etc.). However, when I try to execute a shell script with the unix command, matlab OPENS the shell script instead of executing it. So basically
unix('MyShell.sh')
will open MyShell.sh in a text editor, instead of executing it. Any ideas? I have both the Matlab and Windows environment path variables pointing to the directory MyShell.sh is in.
Thanks a lot!
|
|
0
|
|
|
|
Reply
|
Andres
|
3/22/2011 10:02:04 AM |
|
"Andres " <ablackone@gmail.com> wrote in message
news:im9s2s$8f3$1@fred.mathworks.com...
> Hello, I am trying to execute a bash script in Windows through the 'unix'
> command via Cygwin. Basically, with Cygwin installed, I can use the 'unix'
> command to execute unix commands (grep, find etc.). However, when I try to
> execute a shell script with the unix command, matlab OPENS the shell
> script instead of executing it. So basically unix('MyShell.sh')
> will open MyShell.sh in a text editor, instead of executing it. Any ideas?
> I have both the Matlab and Windows environment path variables pointing to
> the directory MyShell.sh is in.
What is the Windows file association for the extension .sh? What is the
default action that Windows will take?
Just because you're calling the UNIX command doesn't mean that MATLAB will
execute the command "as though" this was a UNIX machine; it simply hands the
command to the OS and says "Here, you execute this."
http://www.mathworks.com/help/techdoc/ref/unix.html
"This function is interchangeable with the system and dos functions. They
all have the same effect."
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|
|
0
|
|
|
|
Reply
|
Steven_Lord
|
3/22/2011 1:34:17 PM
|
|
Hi Steve, thanks for the input. Windows default action is just to open the file in a text editor, now that I know better how everything works I guess it all makes sense.
I managed to find a workaround for executing the script using Cygwin from Matlab. Say the script is "MyScript.sh". It executes with
system('C:\cygwin\bin\bash --login -c "MyScript.sh"');
Thanks!
|
|
0
|
|
|
|
Reply
|
Andres
|
3/22/2011 2:12:04 PM
|
|
"Andres " <ablackone@gmail.com> wrote in message <imaank$ilu$1@fred.mathworks.com>...
> Hi Steve, thanks for the input. Windows default action is just to open the file in a text editor, now that I know better how everything works I guess it all makes sense.
>
> I managed to find a workaround for executing the script using Cygwin from Matlab. Say the script is "MyScript.sh". It executes with
>
> system('C:\cygwin\bin\bash --login -c "MyScript.sh"');
>
> Thanks!
Hello,
That is exactly what i need! However, how could you specify the path of the file "MyScript.sh"?
Thanks!
|
|
0
|
|
|
|
Reply
|
seb6232 (5)
|
8/22/2011 2:23:10 PM
|
|
|
3 Replies
433 Views
(page loaded in 0.107 seconds)
Similiar Articles: Execute Bash script using Cygwin - comp.soft-sys.matlabHello, I am trying to execute a bash script in Windows through the 'unix' command via Cygwin. Basically, with Cygwin installed, I can use the 'unix' c... Failed to login to CDE using cygwin - comp.unix.solarisExecute Bash script using Cygwin - comp.soft-sys.matlab It executes with system('C:\cygwin\bin\bash --login -c ... find a workaround for executing the script using Cygwin ... installing NEDIT on Cygwin and unix in general - comp.unix ...The answer is that in general it is not possible to find ... variable related to a software I am trying to install on ... Execute Bash script using Cygwin - comp.soft-sys ... Bash script - telnet - comp.unix.shellFailed to login to CDE using cygwin - comp.unix.solaris Execute Bash script using Cygwin - comp.soft-sys.matlab... issue, and what then? ... in ... comp.unix.solaris Every ... ln-s does not work.. why? (using cygwin in Windows XP) - comp.unix ...I am using Windows XP and using cygwin. For all these years... I was successful to ... and reinstalled bash, and other coreutils.. i just picked a few items (for ... execute shell script from python, needs sys.argv - comp.lang ...Hi All, I am trying to execute a shell script from within python.. This shell script takes the format, where $1 and $2 are variables from the co... External Shell Execute from abstrakt.com - comp.databases ...Unable to run scripts in current working directory - comp.soft-sys ... External Shell Execute from abstrakt.com - comp.databases ... Execute Bash script using Cygwin ... importing functions from an external bash script - comp.unix.shell ...Execute Bash script using Cygwin - comp.soft-sys.matlab importing functions from an external bash script - comp.unix.shell ... Unable to run scripts in current working ... unable to open X server `' (Magick::ImageMagickError) - comp.lang ...Execute Bash script using Cygwin - comp.soft-sys.matlab unable to open X server `' (Magick::ImageMagickError) - comp.lang ... Execute Bash script using Cygwin - comp.soft ... Unable to execute shell script - comp.unix.solarisExecute Bash script using Cygwin - comp.soft-sys.matlab Unable to execute shell script - comp.unix.solaris And have you started a cygwin ... soft-sys.matlab Unable to run ... Executing Cygwin Bash scripts on Windows « Duncan Smart's WeblogInvoking Cygwin’s Bash, passing it a shell script to execute; Resolving the script’s directory in bash so that it can access other resources its directory. myuser01 - How to run bash shell script in cygwin?How to run bash shell script in cygwin? From: myuser01 <jason dot roy at gdcanada dot com> To: cygwin at cygwin dot com; Date: Thu, 19 Jul 2007 07:40:13 -0700 (PDT) 7/23/2012 8:43:40 AM
|
|
|
|
|
|
|
|
|