Run .sh in cygwin script from cmd

0

I have a .bat script that calls some .exe to generate text files:

generate.bat:
...
ResGen main.txt Main.resources /str:c#
...

After that, I want to use vim's commandline search/replace on the generated file, so I do this C:\cygwin64\bin\bash.exe searchreplace.sh

searchreplace.sh:

echo "Hello from searchreplace.sh.."
vim Main.cs -c ":%s#internal#public#ge | update"

I get this error :

searchreplace.sh: line 2: vim: command not found

I can use vim when I launch Cygwin64 from start menu, seems like a mistake in my scripts.. What am I doing wrong here ?

evictednoise

Posted 2015-05-04T06:28:35.820

Reputation: 101

Where is the vim executable stored? Is the directory part of your PATH? – Karan – 2015-05-04T06:41:29.393

No, it is not. Should it? – evictednoise – 2015-05-04T06:58:48.390

Just guessing whether it's a PATH-related issue. You should probably try the answer below first. – Karan – 2015-05-04T07:00:52.780

Answers

0

Set the fill path to the vim like this:

C:\cygwin64\bin\vim Main.cs -c ":%s#internal#public#ge | update"

or

/drives/c/cygwin64/bin/vim Main.cs -c ":%s#internal#public#ge | update"

Romeo Ninov

Posted 2015-05-04T06:28:35.820

Reputation: 2 062