How to execute a bat file from cygwin bash that uses the Windows find command -
the find
command different in windows , unix. on windows fgrep
-like utility listing matching lines in file; on unix -- , on cygwin -- list filenames matching criteria.
cygwin bash prepends standard directories current path, inside bash $path
typically /bin:/usr/bin:/cygdrive/c/windows/system32:/cygdrive/c/windows
.
begin update provide additional details
for example have many scripts use gnu find
command -- example scripts purge directory trees contain no files:
purge-empty-dirs.sh find . -depth -type d -empty | xargs rmdir -p
i have bat file start build, uses windows find command, searches lines matching string (similar gnu grep
).
build.bat ... dir | find "target" if errorlevel = 1 goto no_target_dir ...
now, bash script work need /bin
in path before c:\windows\system32
. bat file run need c:\windows\system32
in path before /bin
in general might able claim all bat files should executed original environment inherited bash, not modified one. make sense?
end update
this how should be, breaks bat files executed bash. best way address this?
is there way force cygwin execute bat files (or all windows executables) environment started with? thinking of start /i
behavior of cmd.exe. thinking of writing own cygstart
utility this, saving environment (or @ least $path
) in .bash_profile
/.bashrc
. make sense?
any other suggestions?
if chmod +x your.bat
works.
./your.bat
is run via cmd /c
already answered in why cygwin can run .bat scripts?
Comments
Post a Comment