How to execute shell script in cygwin?

2

1

I store name.sh under C:\Documents and Settings\user when i type sh name.sh in Cygwin,

sh: testing.sh: No such file or directory

any help will be appreciated!

Lily

Posted 2011-03-17T03:45:50.763

Reputation: 21

Please don't cross-post.

– Paused until further notice. – 2011-03-17T05:46:26.960

Answers

3

Is that the actual output? If so, it's looking for another script called testing.sh.

testing.sh needs to be in a directory listed in the PATH variable, or you have to run it using a full path, e.g. ./testing.sh or ~/user/testing.sh.

Also don't forget to make testing.sh executable by running chmod +x testing.sh.

Mikel

Posted 2011-03-17T03:45:50.763

Reputation: 7 890

Sorry,actually there is only name.sh involved, typing error – Lily – 2011-03-17T06:12:09.587

That's OK. It's easy to make mistakes when typing. That's why it's better to always post the actual output. Or if you need to hide some sensitive information, copy paste into Notepad, do a Find/Replace, then post that. – Mikel – 2011-03-17T06:21:03.133

0

If you're in C:\Documents and Settings\user when you're running it, try:

./name.sh

If you're not in that directory, you'll need to either change directory there or prepend the command with the location. Here's how to change directory to c:\documents and settings\user

cd /cygdrive/c/"Documents and Settings"/User

You can see which directory you're currently in with the following command, I believe:

pwd

Hyppy

Posted 2011-03-17T03:45:50.763

Reputation: 3 636

I think you may have missed the fact that there are two different filenames involved. – Paused until further notice. – 2011-03-17T04:40:36.737