Friday July 31, 2009 |
Using Cygwin to manage script Virtual Box tasksThe Virtual Box GUI doesn't do everything one needs and so I have been experimenting with using cygwin, a free to use bash shell library. Having installed CYGWIN the first thing to do is add the Virtual Box program folder to the PATH, in my case, export PATH=/cygdrive/c/Program\ Files/Sun/xVM\ VirtualBox:${PATH}
I want this placed in the .bashrc so its always invoked, and thus need to test if is already in the path. I use this code, type -p VBoxManage.exe > /dev/null
case $? in
0) # Its already there
: ;;
1) # Add Path
export PATH=/cygdrive/c/Program\ Files/Sun/xVM\ VirtualBox:${PATH} ;;
esacNow I need to associate a script file type with an execution program. I have tried to use the distributed batch file and binary and neiter of these work, so I have copied cygwin.bat to bash.bat and amended it so that it reads as follows @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 %*I have deleted the -i flag from the bash line, I have made the bash program call absolute, %* is the DOS batch command file syntax equivilant to $* i.e. all the command line arguments, so the command line invokes bash.exe in login mode to force the execution of .bash_profile and .bashrc and appends all the other command line parameters including the script file name. :: is a neater comment delimiter than REM. I have associated my batch file with the file type .ksh as the open method using explorer. Much of CYGWIN is distributed under the GPL and I am unclear if the batch file is included, If so, its GPL since I created the file by copying it. keywords: howto invoke cygwin scripts from the windows desktop, write a dos batch file to invoke shell tags: technology virtualbox shell scripting cygwin windows (2009-07-31 06:58:27.0) Permalink Comments:
Post a Comment: Comments are closed for this entry. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||