public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How to run bash shell script in cygwin?
@ 2007-07-19 14:40 myuser01
  2007-07-19 14:42 ` Larry Hall (Cygwin)
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: myuser01 @ 2007-07-19 14:40 UTC (permalink / raw)
  To: cygwin


I have a script called "batchjob" that looks like this:
    #!/bin/bash
    echo 'I was here'

-rwxr-xr-x  1 c10066 mkpasswd   48 Jul 19 09:30 batchjob

But when I try to execute it from the cygwin shell I get this: 
$ batchjob
bash: batchjob: command not found

How do i execute a bash shell script from within cygwin?

Thanks
-- 
View this message in context: http://www.nabble.com/How-to-run-bash-shell-script-in-cygwin--tf4111558.html#a11690723
Sent from the Cygwin Users 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] 14+ messages in thread

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:40 How to run bash shell script in cygwin? myuser01
@ 2007-07-19 14:42 ` Larry Hall (Cygwin)
  2007-07-19 14:47   ` myuser01
  2007-07-19 14:49   ` Brian Mathis
  2010-05-25  8:31 ` Vinoth Manimaran
  2011-02-05 22:39 ` Jose.Torres
  2 siblings, 2 replies; 14+ messages in thread
From: Larry Hall (Cygwin) @ 2007-07-19 14:42 UTC (permalink / raw)
  To: cygwin

myuser01 wrote:
> I have a script called "batchjob" that looks like this:
>     #!/bin/bash
>     echo 'I was here'
> 
> -rwxr-xr-x  1 c10066 mkpasswd   48 Jul 19 09:30 batchjob
> 
> But when I try to execute it from the cygwin shell I get this: 
> $ batchjob
> bash: batchjob: command not found
> 
> How do i execute a bash shell script from within cygwin?

This is not a Cygwin problem.  It's a usage issue.  You'd see
the same problem on other platforms.  Try:

./batchjob

-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
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] 14+ messages in thread

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:42 ` Larry Hall (Cygwin)
@ 2007-07-19 14:47   ` myuser01
  2007-07-19 14:50     ` Reid Thompson
  2012-03-30 14:54     ` iloveunix
  2007-07-19 14:49   ` Brian Mathis
  1 sibling, 2 replies; 14+ messages in thread
From: myuser01 @ 2007-07-19 14:47 UTC (permalink / raw)
  To: cygwin


Thanks for the help.  What does the ./ do, please be as detailed as possible?
-- 
View this message in context: http://www.nabble.com/How-to-run-bash-shell-script-in-cygwin--tf4111558.html#a11690870
Sent from the Cygwin Users 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] 14+ messages in thread

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:42 ` Larry Hall (Cygwin)
  2007-07-19 14:47   ` myuser01
@ 2007-07-19 14:49   ` Brian Mathis
  1 sibling, 0 replies; 14+ messages in thread
From: Brian Mathis @ 2007-07-19 14:49 UTC (permalink / raw)
  To: cygwin

On 7/19/07, Larry Hall (Cygwin) <reply-to-list-only-lh@cygwin.com> wrote:
> myuser01 wrote:
> > I have a script called "batchjob" that looks like this:
> >     #!/bin/bash
> >     echo 'I was here'
> >
> > -rwxr-xr-x  1 c10066 mkpasswd   48 Jul 19 09:30 batchjob
> >
> > But when I try to execute it from the cygwin shell I get this:
> > $ batchjob
> > bash: batchjob: command not found
> >
> > How do i execute a bash shell script from within cygwin?
>
> This is not a Cygwin problem.  It's a usage issue.  You'd see
> the same problem on other platforms.  Try:
>
> ./batchjob
>
> --
> Larry Hall                              http://www.rfk.com

... and the reason for this is because the current directory, called
"." (dot), is not normally in the PATH environment variable.  This
variable is used to find programs that you are trying to run.  Since
"." is not in that list, it will not find the script.

Adding the "./" in front of the command name tells the shell to "look
in this directory (.) for the command"

You can read more about this by doing a google search like:
    http://www.google.com/search?q=path+environment+variable

--
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] 14+ messages in thread

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:47   ` myuser01
@ 2007-07-19 14:50     ` Reid Thompson
  2007-07-19 14:56       ` myuser01
  2007-07-19 15:00       ` Dave Korn
  2012-03-30 14:54     ` iloveunix
  1 sibling, 2 replies; 14+ messages in thread
From: Reid Thompson @ 2007-07-19 14:50 UTC (permalink / raw)
  To: myuser01; +Cc: cygwin


On Thu, 2007-07-19 at 07:47 -0700, on behalf of myuser01 wrote:
> Thanks for the help.  What does the ./ do, please be as detailed as possible?

http://www.linuxheadquarters.com/howto/basic/path.shtml   

by default, the current working directory ( . ), is not in the PATH.
Using ./filename, provides the relative path to the executable to bash

--
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] 14+ messages in thread

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:50     ` Reid Thompson
@ 2007-07-19 14:56       ` myuser01
  2007-07-19 15:00       ` Dave Korn
  1 sibling, 0 replies; 14+ messages in thread
From: myuser01 @ 2007-07-19 14:56 UTC (permalink / raw)
  To: cygwin


Makes sense now. Thanks for the help.
-- 
View this message in context: http://www.nabble.com/How-to-run-bash-shell-script-in-cygwin--tf4111558.html#a11691059
Sent from the Cygwin Users 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] 14+ messages in thread

* RE: How to run bash shell script in cygwin?
  2007-07-19 14:50     ` Reid Thompson
  2007-07-19 14:56       ` myuser01
@ 2007-07-19 15:00       ` Dave Korn
  2012-04-03 15:43         ` Marc Girod
  1 sibling, 1 reply; 14+ messages in thread
From: Dave Korn @ 2007-07-19 15:00 UTC (permalink / raw)
  To: cygwin

On 19 July 2007 15:51, Reid Thompson wrote:

> On Thu, 2007-07-19 at 07:47 -0700, on behalf of myuser01 wrote:
>> Thanks for the help.  What does the ./ do, please be as detailed as
>> possible? 
> 
> http://www.linuxheadquarters.com/howto/basic/path.shtml
> 


  Hey, why not plug our own faq while we're at it?

http://cygwin.com/faq/faq.using.html#faq.using.not-found


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
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] 14+ messages in thread

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:40 How to run bash shell script in cygwin? myuser01
  2007-07-19 14:42 ` Larry Hall (Cygwin)
@ 2010-05-25  8:31 ` Vinoth Manimaran
  2010-05-25 10:05   ` Nabble'd again [was Re: How to run bash shell script in cygwin?] Dave Korn
  2010-05-25 13:58   ` How to run bash shell script in cygwin? Tim Prince
  2011-02-05 22:39 ` Jose.Torres
  2 siblings, 2 replies; 14+ messages in thread
From: Vinoth Manimaran @ 2010-05-25  8:31 UTC (permalink / raw)
  To: cygwin


Hai,

Soln : type the following

bash batchjob.sh

you will get the results

comments are invites to mvinoth_1@yahoo.com



myuser01 wrote:
> 
> I have a script called "batchjob" that looks like this:
>     #!/bin/bash
>     echo 'I was here'
> 
> -rwxr-xr-x  1 c10066 mkpasswd   48 Jul 19 09:30 batchjob
> 
> But when I try to execute it from the cygwin shell I get this: 
> $ batchjob
> bash: batchjob: command not found
> 
> How do i execute a bash shell script from within cygwin?
> 
> Thanks
> 

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


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

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

* Nabble'd again [was Re: How to run bash shell script in cygwin?]
  2010-05-25  8:31 ` Vinoth Manimaran
@ 2010-05-25 10:05   ` Dave Korn
  2010-05-25 13:58   ` How to run bash shell script in cygwin? Tim Prince
  1 sibling, 0 replies; 14+ messages in thread
From: Dave Korn @ 2010-05-25 10:05 UTC (permalink / raw)
  To: cygwin

On 25/05/2010 08:29, Vinoth Manimaran wrote:
> Hai,

  Yeah, we answered this one three years ago.  Please try and remember that
Nabble archives old posts as well as new ones.

    cheers,
      DaveK


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

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

* Re: How to run bash shell script in cygwin?
  2010-05-25  8:31 ` Vinoth Manimaran
  2010-05-25 10:05   ` Nabble'd again [was Re: How to run bash shell script in cygwin?] Dave Korn
@ 2010-05-25 13:58   ` Tim Prince
  1 sibling, 0 replies; 14+ messages in thread
From: Tim Prince @ 2010-05-25 13:58 UTC (permalink / raw)
  To: cygwin

On 5/25/2010 12:29 AM, Vinoth Manimaran wrote:
> Hai,
>
> Soln : type the following
>
> bash batchjob.sh
>
> you will get the results
>
> comments are invites to mvinoth_1@yahoo.com
>
>
>
> myuser01 wrote:
>    
>> I have a script called "batchjob" that looks like this:
>>      #!/bin/bash
>>      echo 'I was here'
>>
>> -rwxr-xr-x  1 c10066 mkpasswd   48 Jul 19 09:30 batchjob
>>
>> But when I try to execute it from the cygwin shell I get this:
>> $ batchjob
>> bash: batchjob: command not found
>>
>> How do i execute a bash shell script from within cygwin?
>>
>> Thanks
>>
>>      
>    
or consult any basic doc about bash default paths, e.g. 
http://www.linuxfromscratch.org/blfs/view/6.3/postlfs/profile.html

-- 
Tim Prince


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

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

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:40 How to run bash shell script in cygwin? myuser01
  2007-07-19 14:42 ` Larry Hall (Cygwin)
  2010-05-25  8:31 ` Vinoth Manimaran
@ 2011-02-05 22:39 ` Jose.Torres
  2 siblings, 0 replies; 14+ messages in thread
From: Jose.Torres @ 2011-02-05 22:39 UTC (permalink / raw)
  To: cygwin


Hi myuser01,

On a bash or similar shell, you need to include the location to the
executable file in order to execute it. If the executable directory is not
in one of your bin folders you can execute it as part of your PATH. 

try the following:


$ pwd
$ echo $PATH
$ export $PATH=$PATH;`pwd`

Other people may prefer a .bashrc or similar .bash_profile files. 

I found this post on google when searching for executing bash files in
apache.
http://old.nabble.com/How-to-run-bash-shell-script-in-cygwin--to11690723.html#a11690723

Regards,
Jose Torres

:working: 
:music:



myuser01 wrote:
> 
> I have a script called "batchjob" that looks like this:
>     #!/bin/bash
>     echo 'I was here'
> 
> -rwxr-xr-x  1 c10066 mkpasswd   48 Jul 19 09:30 batchjob
> 
> But when I try to execute it from the cygwin shell I get this: 
> $ batchjob
> bash: batchjob: command not found
> 
> How do i execute a bash shell script from within cygwin?
> 
> Thanks
> 

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


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

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

* Re: How to run bash shell script in cygwin?
  2007-07-19 14:47   ` myuser01
  2007-07-19 14:50     ` Reid Thompson
@ 2012-03-30 14:54     ` iloveunix
  1 sibling, 0 replies; 14+ messages in thread
From: iloveunix @ 2012-03-30 14:54 UTC (permalink / raw)
  To: cygwin


the "./" tells bash to look for your script in the current working directory
instead of looking for the script as defined by the standard path set during
the start of your session.

myuser01 wrote:
> 
> Thanks for the help.  What does the ./ do, please be as detailed as
> possible?
> 

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


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

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

* RE: How to run bash shell script in cygwin?
  2007-07-19 15:00       ` Dave Korn
@ 2012-04-03 15:43         ` Marc Girod
  2012-04-03 19:20           ` Andrey Repin
  0 siblings, 1 reply; 14+ messages in thread
From: Marc Girod @ 2012-04-03 15:43 UTC (permalink / raw)
  To: cygwin


Hi,


Dave Korn wrote:
> 
>  Hey, why not plug our own faq while we're at it?
> 
> http://cygwin.com/faq/faq.using.html#faq.using.not-found
> 
One minor comment I have about point 12 in the FAQ, now that I went reading.
The following advice is given:
  You should rather install sshd and use ssh username@localhost as a su
replacement. 

With ssh, use rather: ssh username@$(hostname)

This is because ssh will record the host key with the name.
You don't want to record random host keys with the stable 'localhost' name.

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


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

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

* Re: How to run bash shell script in cygwin?
  2012-04-03 15:43         ` Marc Girod
@ 2012-04-03 19:20           ` Andrey Repin
  0 siblings, 0 replies; 14+ messages in thread
From: Andrey Repin @ 2012-04-03 19:20 UTC (permalink / raw)
  To: Marc Girod, cygwin

Greetings, Marc Girod!

>>  Hey, why not plug our own faq while we're at it?
>> 
>> http://cygwin.com/faq/faq.using.html#faq.using.not-found
>> 
> One minor comment I have about point 12 in the FAQ, now that I went reading.
> The following advice is given:
>   You should rather install sshd and use ssh username@localhost as a su
> replacement. 

> With ssh, use rather: ssh username@$(hostname)

> This is because ssh will record the host key with the name.
> You don't want to record random host keys with the stable 'localhost' name.

Took me a few moments to realize, but I think this is possible even now,
when you use ssh on localhost:mapped-port.


--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 03.04.2012, <23:05>

Sorry for my terrible english...


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

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

end of thread, other threads:[~2012-04-03 19:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-19 14:40 How to run bash shell script in cygwin? myuser01
2007-07-19 14:42 ` Larry Hall (Cygwin)
2007-07-19 14:47   ` myuser01
2007-07-19 14:50     ` Reid Thompson
2007-07-19 14:56       ` myuser01
2007-07-19 15:00       ` Dave Korn
2012-04-03 15:43         ` Marc Girod
2012-04-03 19:20           ` Andrey Repin
2012-03-30 14:54     ` iloveunix
2007-07-19 14:49   ` Brian Mathis
2010-05-25  8:31 ` Vinoth Manimaran
2010-05-25 10:05   ` Nabble'd again [was Re: How to run bash shell script in cygwin?] Dave Korn
2010-05-25 13:58   ` How to run bash shell script in cygwin? Tim Prince
2011-02-05 22:39 ` Jose.Torres

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