public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Calling Cygwin from Dos - problem with sub program
@ 2008-04-18  4:42 nlian
  2008-04-22  7:23 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: nlian @ 2008-04-18  4:42 UTC (permalink / raw)
  To: cygwin


Hi,

I have a bash script (e.g. test.sh), and I have the following  command
inside the script:

#!/usr/bin/bash
export PROG_LIB="D:\batch\prod\prog\lib"
export PATH="$PROG_LIB:$PATH"

#include functions from functions.library file
. functions.library

#Using logmsg function:
logmsg "This is the beginning" 
====

When I ran from cygwin, I got no error when executing the shell script
(test.sh), all OK.

However when I execute from dos, I got an error: 
         functions.library: No such file or directory
         logmsg: command not found

Here is my dos script,  test.cmd:

@echo off

D:
chdir D:\cygwin\bin
bash --login -c '/cygdrive/d/Batch/prod/prog/scripts/test.sh'

Any idea what's missing / went wrong?

Thanks,

Lian
-- 
View this message in context: http://www.nabble.com/Calling-Cygwin-from-Dos---problem-with-sub-program-tp16760067p16760067.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] 3+ messages in thread

* Re: Calling Cygwin from Dos - problem with sub program
  2008-04-18  4:42 Calling Cygwin from Dos - problem with sub program nlian
@ 2008-04-22  7:23 ` Eric Blake
  2008-04-23  5:26   ` nlian
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2008-04-22  7:23 UTC (permalink / raw)
  To: cygwin, norliansyah

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to nlian on 4/17/2008 9:58 PM:
| Hi,
|
| I have a bash script (e.g. test.sh), and I have the following  command
| inside the script:
|
| #!/usr/bin/bash
| export PROG_LIB="D:\batch\prod\prog\lib"

Non-portable use of back-slashes.  But more importantly, a non-POSIX path
inside a bash script.

| export PATH="$PROG_LIB:$PATH"

Running this script with 'bash -vx', or adding 'cmd /c echo %PATH%', may
prove instructive of what you are setting PATH to.  For starters, the
leading D followed by a path separator : means that you are searching the
relative directory D (and not anchoring a path in the d drive; for that
you need /cygdrive/d/).

| However when I execute from dos, I got an error:
|          functions.library: No such file or directory

Probably because your PATH wasn't set correctly.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgNYykACgkQ84KuGfSFAYClIwCfbLEKsN0jHJvGRj36iYcTt62u
K80An0ZNRGTqkBz13Z3JY+MieCD/XyeT
=Db1W
-----END PGP SIGNATURE-----

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

* Re: Calling Cygwin from Dos - problem with sub program
  2008-04-22  7:23 ` Eric Blake
@ 2008-04-23  5:26   ` nlian
  0 siblings, 0 replies; 3+ messages in thread
From: nlian @ 2008-04-23  5:26 UTC (permalink / raw)
  To: cygwin


Hi Eric,

You are genius! :)
I change the path to use /cygdrive/d/ and it works!

Cheers,

Lian



Eric Blake wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> According to nlian on 4/17/2008 9:58 PM:
> | Hi,
> |
> | I have a bash script (e.g. test.sh), and I have the following  command
> | inside the script:
> |
> | #!/usr/bin/bash
> | export PROG_LIB="D:\batch\prod\prog\lib"
> 
> Non-portable use of back-slashes.  But more importantly, a non-POSIX path
> inside a bash script.
> 
> | export PATH="$PROG_LIB:$PATH"
> 
> Running this script with 'bash -vx', or adding 'cmd /c echo %PATH%', may
> prove instructive of what you are setting PATH to.  For starters, the
> leading D followed by a path separator : means that you are searching the
> relative directory D (and not anchoring a path in the d drive; for that
> you need /cygdrive/d/).
> 
> | However when I execute from dos, I got an error:
> |          functions.library: No such file or directory
> 
> Probably because your PATH wasn't set correctly.
> 
> - --
> Don't work too hard, make some time for fun as well!
> 
> Eric Blake             ebb9@byu.net
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (Cygwin)
> Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkgNYykACgkQ84KuGfSFAYClIwCfbLEKsN0jHJvGRj36iYcTt62u
> K80An0ZNRGTqkBz13Z3JY+MieCD/XyeT
> =Db1W
> -----END PGP SIGNATURE-----
> 
> --
> 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/
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Calling-Cygwin-from-Dos---problem-with-sub-program-tp16760067p16830823.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] 3+ messages in thread

end of thread, other threads:[~2008-04-23  4:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-18  4:42 Calling Cygwin from Dos - problem with sub program nlian
2008-04-22  7:23 ` Eric Blake
2008-04-23  5:26   ` nlian

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