public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How to run a bash shell script from cygwin coosole
@ 2008-07-17 19:17 akarui
  2008-07-17 19:22 ` Greg Chicares
  0 siblings, 1 reply; 8+ messages in thread
From: akarui @ 2008-07-17 19:17 UTC (permalink / raw)
  To: cygwin


I have a very simple bash script named runRWS.sh:
/************
#!/bin/bash
cd /soapui
ls
pwd
************/

When I run from cygwin console, , I get:
/************
user1@INNO-CNU75109V7 /usr/bin
$ ./runRWS.sh
: No such file or directoryoapui
./runRWS.sh: line 3: $'ls\r': command not found
/usr/bin
************/

I could see that command "cd", "ls" didn't work, but "pwd" was ok.

I have directories mounted as below:
/*************
$ mount
c:\Program Files\eviware\soapUI-Pro-2.0.3\bin on /soapui type system
(binmode)
d:\cygwin\bin on /usr/bin type system (binmode)
d:\cygwin\lib on /usr/lib type system (binmode)
d:\cygwin on / type system (binmode)
c: on /cygdrive/c type system (binmode,noumount)
d: on /cygdrive/d type system (binmode,noumount)
g: on /cygdrive/g type system (binmode,noumount)
h: on /cygdrive/h type system (binmode,noumount)
m: on /cygdrive/m type system (binmode,noumount)
r: on /cygdrive/r type system (binmode,noumount)
**************/

Please help me how to run the bash script on cygwin. Note, I am a new user
of cygwin.

-- 
View this message in context: http://www.nabble.com/How-to-run-a-bash-shell-script-from-cygwin-coosole-tp18515908p18515908.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to run a bash shell script from cygwin coosole
  2008-07-17 19:17 How to run a bash shell script from cygwin coosole akarui
@ 2008-07-17 19:22 ` Greg Chicares
  2008-07-17 20:11   ` akarui
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Chicares @ 2008-07-17 19:22 UTC (permalink / raw)
  To: cygwin

On 2008-07-17 19:17Z, akarui wrote:
> 
> ./runRWS.sh: line 3: $'ls\r': command not found

d2u ./runRWS.sh

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to run a bash shell script from cygwin coosole
  2008-07-17 19:22 ` Greg Chicares
@ 2008-07-17 20:11   ` akarui
  2008-07-17 20:22     ` Christopher Faylor
  0 siblings, 1 reply; 8+ messages in thread
From: akarui @ 2008-07-17 20:11 UTC (permalink / raw)
  To: cygwin



Greg Chicares-2 wrote:
> 
> On 2008-07-17 19:17Z, akarui wrote:
>> 
>> ./runRWS.sh: line 3: $'ls\r': command not found
> 
> d2u ./runRWS.sh
> 

I am using Crimson editor and saved the file in UNIX format, but still
seeing the error "$ls\r".
How can I get rid of this problem ?

-- 
View this message in context: http://www.nabble.com/How-to-run-a-bash-shell-script-from-cygwin-coosole-tp18515908p18516861.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to run a bash shell script from cygwin coosole
  2008-07-17 20:11   ` akarui
@ 2008-07-17 20:22     ` Christopher Faylor
  2008-07-17 20:52       ` akarui
  0 siblings, 1 reply; 8+ messages in thread
From: Christopher Faylor @ 2008-07-17 20:22 UTC (permalink / raw)
  To: cygwin

On Thu, Jul 17, 2008 at 01:10:31PM -0700, akarui wrote:
>
>
>Greg Chicares-2 wrote:
>> 
>> On 2008-07-17 19:17Z, akarui wrote:
>>> 
>>> ./runRWS.sh: line 3: $'ls\r': command not found
>> 
>> d2u ./runRWS.sh
>> 
>
>I am using Crimson editor and saved the file in UNIX format, but still
>seeing the error "$ls\r".
>How can I get rid of this problem ?

d2u ./runRWS.sh

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to run a bash shell script from cygwin coosole
  2008-07-17 20:22     ` Christopher Faylor
@ 2008-07-17 20:52       ` akarui
  2008-07-17 21:27         ` How to run a bash shell script from cygwin console akarui
  0 siblings, 1 reply; 8+ messages in thread
From: akarui @ 2008-07-17 20:52 UTC (permalink / raw)
  To: cygwin




Christopher Faylor-8 wrote:
> 
> d2u ./runRWS.sh
> 
> cgf
> 

Thanks. It is working upto here.
-- 
View this message in context: http://www.nabble.com/How-to-run-a-bash-shell-script-from-cygwin-coosole-tp18515908p18517222.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to run a bash shell script from cygwin console
  2008-07-17 20:52       ` akarui
@ 2008-07-17 21:27         ` akarui
  2008-07-17 21:33           ` Sam Hanes
  0 siblings, 1 reply; 8+ messages in thread
From: akarui @ 2008-07-17 21:27 UTC (permalink / raw)
  To: cygwin


Now, I have new issue after adding a line ("cd") in the script. New script
looks like as below:
/****************
#!/bin/bash
cd "c:\Program Files\eviware\soapUI-Pro-2.0.3\bin"    #This is mount-mapped
as "/soapui"
pwd
ls
****************/

The output I get on the cygwin console is as follow:
/****************
$ ./runRWS.sh
/soapui
Project_Exercise18     alltests-fails.html  mockservicerunner.bat 
soapui-errors.log     soapui.log
actions                ext                  overview-frame.html   
soapui-log4j.xml      stylesheet.css
all-tests.html         index.html           overview-summary.html 
soapui-pro-2.0.3.jar  testrunner.bat
allclasses-frame.html  listeners            report.xml            
soapui-pro.bat        toolrunner.bat
alltests-errors.html   loadtestrunner.bat   scripts               
soapui-settings.xml
****************/

Here from the output, I see that "cd", "pwd" and "ls" worked fine. But the
console prompt is not yet changed, means, "cd" didn't permanently changed
the directory, 'cause I get "pwd" as below:
/****************
$ pwd
/cygdrive/d
****************/

Note that, I like to have the console's prompt changed to "/soapui", where
I'll run a program named "testrunner.bat" later.

Please help me.


-- 
View this message in context: http://www.nabble.com/How-to-run-a-bash-shell-script-from-cygwin-coosole-tp18515908p18517238.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to run a bash shell script from cygwin console
  2008-07-17 21:27         ` How to run a bash shell script from cygwin console akarui
@ 2008-07-17 21:33           ` Sam Hanes
  2008-07-18  3:43             ` Ken Jackson
  0 siblings, 1 reply; 8+ messages in thread
From: Sam Hanes @ 2008-07-17 21:33 UTC (permalink / raw)
  To: cygwin

akarui wrote:
>
> Here from the output, I see that "cd", "pwd" and "ls" worked fine. But the
> console prompt is not yet changed, means, "cd" didn't permanently changed
> the directory, 'cause I get "pwd" as below:
> /****************
> $ pwd
> /cygdrive/d
> ****************/
>
> Note that, I like to have the console's prompt changed to "/soapui", where
> I'll run a program named "testrunner.bat" later.
>

BASH runs scripts in a sub-shell, and changes made to the environment
in the sub-shell do not propagate to the parent shell. To run a script
in the current shell so it can change your environment, call it as `.
yourscript` instead of just `yourscript`. AFAIK there's nothing that
you can put in the script to make it do this all the time.

-- Sam Hanes
elemecca AT gmail DOT com

Freedom is a heavy load, a great and strange burden for the spirit to
undertake. It is not easy. It is not a gift given, but a choice made,
and the choice may be a hard one. The road goes upward towards the
light; but the laden traveler may never reach the end of it.
- Ursula K. Le Guin; The Tombs of Atuan

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to run a bash shell script from cygwin console
  2008-07-17 21:33           ` Sam Hanes
@ 2008-07-18  3:43             ` Ken Jackson
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Jackson @ 2008-07-18  3:43 UTC (permalink / raw)
  To: cygwin

Sam Hanes writes:
 > akarui wrote:
 > >
 > > Here from the output, I see that "cd", "pwd" and "ls" worked fine. But the
 > > console prompt is not yet changed, means, "cd" didn't permanently changed
 > > the directory, 'cause I get "pwd" as below:
 > > /****************
 > > $ pwd
 > > /cygdrive/d
 > > ****************/
 > >
 > > Note that, I like to have the console's prompt changed to "/soapui", where
 > > I'll run a program named "testrunner.bat" later.
 > >
 > 
 > BASH runs scripts in a sub-shell, and changes made to the environment
 > in the sub-shell do not propagate to the parent shell. To run a script
 > in the current shell so it can change your environment, call it as `.
 > yourscript` instead of just `yourscript`. AFAIK there's nothing that
 > you can put in the script to make it do this all the time.

True, but you can combine a script and an alias to give you the
effect.

Maybe put runRWS.sh in ~/bin/ and then add this alias to
~/.bash_profile or ~/.bashrc:

alias runRWS=". ~/bin/runRWS.sh"

Then the command runRWS will work as you expect.

-Ken Jackson

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-18  3:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-17 19:17 How to run a bash shell script from cygwin coosole akarui
2008-07-17 19:22 ` Greg Chicares
2008-07-17 20:11   ` akarui
2008-07-17 20:22     ` Christopher Faylor
2008-07-17 20:52       ` akarui
2008-07-17 21:27         ` How to run a bash shell script from cygwin console akarui
2008-07-17 21:33           ` Sam Hanes
2008-07-18  3:43             ` Ken Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).