Shell Scripting on Windows

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.

Related Posts

  • Centos 6.x I downloaded this from http://centos.mirroring.pulsant.co.uk/6.4/isos/x86_64/ The […]
  • Microsoft RDP & Virtual Box At some point Virtual Box came with RDP as part of the set up and its allegedly faster […]
  • Managing Docker with Panamax & Vagrant I got distracted and was pointed at Kitematic, but it's Mac only and so I moved on to […]
  • OpenSUSE and Virtual Box I have been experimenting with an OpenSUSE Linux VM running in Virtual Box. This is […]
  • Virtual Box This page has been live for a long time. Sun Microsystems bought Innotek the authors of […]

Leave a Reply

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