I want to write bash scripts to be emulated using cygwin. This has a problem in that XP uses spaces in its file folder hierarchies and the environment variable initialisation process isn’t good enough. This is actually a snip on writing shell script using cygwin. The virtual boix commands are just the use case which led to me doing the research.

VBoxManage.exe list vms

doesn’t work and list systemproperties shows it thinks that the .VirtualBox directory is in the cygwin home.

This thread at Virtual Box fourms discusses the issue. It seems to be not quite appropriate.

I have added the following code to .bashrc

type -p VBoxManage.exe > /dev/null
case $? in
0)   : ;;
1)   export PATH=/cygdrive/c/Program Files/Sun/xVM VirtualBox:${PATH} ;;
esac

This prepends the vbox directory to the Path. VBoxManage.exe list vms seems to work from the home directory now.

I have installed a new bash.bat file. This is located beside cygwin.bat. It consists of,

@echo off
:: Dave Levy (c) 2009 Is this GPL? :: bash.bat Version 1.0

:: Wrapper to run *sh scripts from windows explorer/desktop

c:\ksh\bin\bash --login %*

This is also covered on my blog in an article called Using Cygwin to manage script Virtual Box tasks.

Next I need to invoke it from tcl/tk.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.