<div dir="ltr">Ahh, Win-BASH cool!!!<br><br><div class="gmail_quote">On Tue, Jul 15, 2008 at 10:41 AM, Aquil H. Abdullah <<a href="mailto:aquil.abdullah@gmail.com">aquil.abdullah@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Ack, .bat files! Yes, you are correct Windows does not ship with Python, and there are ways to get bash (cygwin) on your Windoze system.  I am leaning towards a solution similar to your second suggestion as it will keep me from having to distribute .bat files for one platform and .sh files for another.  Thank you for all of your suggestions.<div>
<div></div><div class="Wj3C7c"><br>
<br><div class="gmail_quote">On Mon, Jul 14, 2008 at 8:39 PM, Derek Martin <<a href="mailto:code@pizzashack.org" target="_blank">code@pizzashack.org</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div>On Mon, Jul 14, 2008 at 05:40:43PM -0400, Aquil H. Abdullah wrote:<br>
> You've hit the proverbial nail with the hammer.  The problem is that my<br>
> application needs to run under both the Linux and Windows OSs, so while I<br>
> would love to use a nice sh, csh, or bash shell script. My hands are tied<br>
> because Windows does not provide such wonderful shells.<br>
<br>
</div>*Provides*, no... neither does it provide Python, for what that's<br>
worth.  But you can certainly get it (bash):<br>
<br>
  <a href="http://win-bash.sourceforge.net/" target="_blank">http://win-bash.sourceforge.net/</a><br>
<br>
I suppose it's not worth installing just for this purpose though...<br>
But you can provide with your application a DoS batch file that does<br>
exactly the same thing (in addition to a shell script).  The user<br>
would quite intuitively use whichever were appropriate, or follow your<br>
provided directions otherwise.  Or, the equivalent in (hopefully<br>
OS-agnostic) Python:<br>
<br>
import os, sys<br>
<br>
# I believe this gets the name of the root in all major OSes<br>
def root_dir(path):<br>
        if os.path.dirname(path) == path:<br>
                return path<br>
        return (root_dir(os.path.dirname(path)))<br>
<br>
appname = <name of your python script><br>
root = root_dir(os.getcwd())<br>
install_path = os.path.join(root, "usr")<br>
bin_path = os.path.join(install_path, "bin")<br>
os.environ["PATH"] = bin_path + os.pathsep + os.environ["PATH"]<br>
python_path = os.path.join(bin_path, "python")<br>
args = sys.argv[1:]<br>
args.insert(0, os.path.join(bin_path, appname))<br>
args.insert(0, python_path)<br>
args.insert(0, python_path)<br>
os.execv(python_path, args)<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br></div></div><div class="Ih2E3d">-- <br>Aquil H. Abdullah<br><a href="mailto:aquil.abdullah@gmail.com" target="_blank">aquil.abdullah@gmail.com</a>
</div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Aquil H. Abdullah<br><a href="mailto:aquil.abdullah@gmail.com">aquil.abdullah@gmail.com</a>
</div>