Get current execution environment

I am writing a script that will need to run in both cygwin and the
windows cmd shell. That being said I need a way to determine which one
of them my script is running in.

When I use ENV[‘os’] or RUBY_PLATFORM I am getting information about the
actually OS not the execution environment.

Is there a way to determine the execution environment of a ruby script?

Thanks
Hunter

You might check whether any of these env vars (from my MSYS) are
available in cygwin and not in cmd.exe:

TERM
PWD
OLDPWD
MSYSCON
PS1
SHLVL
MSYSTEM
_

What are you trying to do from Ruby that requires this knowledge?

Jon

Jon F. wrote in post #1008271:

What are you trying to do from Ruby that requires this knowledge?

Jon

During the execution of my script I query a mysql database and export
XML files, I don’t need the files after execution so as the last step I
want my script to remove the XML files from the directory.

On windows I would normally use: DEL *.xml
On Linux/Cygwin: rm *.xml

Hunter

Try these…

http://rubydoc.info/stdlib/core/1.9.2/File#delete-class_method

http://rubydoc.info/stdlib/fileutils/1.9.2/file/README.rdoc

http://rubydoc.info/stdlib/core/1.9.2/Dir#glob-class_method

Thanks, this works out much better than what I was looking for.

Hunter