1. [OT] bash script - How do you do this on Windows?
- Posted by Jerry Story Jul 04, 2008
- 838 views
I recently learned of the existence of wget. Very useful. The following bash script installs some stuff. How can the same thing be done on Windows? Windows seems to not have (as part of it) wget or anything similar. So translating the following code for Windows in a way that it will work for everyone does not seem to be a doable proposition. Maybe this whole idea is wrong. Is there a better idea? <begin bash code> #!/bin/bash # Install: # libwxeu.so # dmak # usda data # Install libwxeu.so for binded wxEuphoria based projects. install_wxeu() { local WXEU=libwxeu.so.12 local WXEUZ=wxeu-src-gtk-0-12-beta-1.tar.gz # Probably we should test whether wxwidgets is installed. # Put libwxeu.so where it belongs. local_lib() { if [ -f $WXEU ]; then cp $WXEU /usr/local/lib sudo ldconfig /usr/local/lib echo $WXEU is installed else echo $WXEU is not installed fi } # Extract the .so file from the tar.gz file. extract_so() { tar -xzf $WXEUZ if [ -d wxEuphoria ]; then cp wxEuphoria/$WXEU $WXEU local_lib rm wxEuphoria else echo No wxEuphoria directory in $WXEUZ fi } # This is the main line for install_wxeu. if [ -f /usr/local/lib/$WXEU ]; then echo $WXEU is already installed. elif [ -f $WXEU ]; then local_lib else if [ -f $WXEUZ ]; then echo You have $WXEUZ extract_so else echo downloading $WXEUZ wget http://www3.telus.net/%7Ejtstory/libraries/$WXEUZ echo downloaded $WXEUZ extract_so fi fi } install_diet_monger_ass_kicker() { if [ -d dmak/usda_data ]; then echo 'You already have dmak.' echo 'Do you want to update dmak (ini files unchanged)? y N' read update if [$update = "y"]; then echo 'Downloading Diet Monger Ass Kicker' wget http://www3.telus.net/%7Ejtstory/programs-dmak/dmak.zip echo 'downloaded Diet Monger Ass Kicker' unzip dmak.zip -x dmak/ini/*.* rm dmak.zip fi else echo 'Downloading Diet Monger Ass Kicker' wget http://www3.telus.net/%7Ejtstory/programs-dmak/dmak.zip echo 'downloaded Diet Monger Ass Kicker' unzip dmak.zip rm dmak.zip fi } install_usda() { local USDAZ=sr20.zip if [ -f dmak/usda_data/NUT_DATA.txt ]; then echo 'You already have usda data.' echo 'Do you want to update usda data? y N' read update if [$update = "y"]; then echo downloading $USDAZ wget http://www3.telus.net/%7Ejtstory/programs-dmak/data/$USDAZ echo downloaded $USDAZ unzip $USDAZ -d dmak/usda_data rm $USDAZ fi else echo You need usda data. echo downloading $USDAZ wget http://www3.telus.net/%7Ejtstory/programs-dmak/data/$USDAZ echo downloaded $USDAZ unzip $USDAZ -d dmak/usda_data rm $USDAZ fi } # This is the main line for the whole thing. install_wxeu install_diet_monger_ass_kicker install_usda echo If all went well, dmak is ready to run. <end bash code>
2. Re: [OT] bash script - How do you do this on Windows?
- Posted by Jeremy Cowgar Jul 04, 2008
- 827 views
I still need to do a bit of work on the formatting. Creole formats your text as a document writer would. The way you enter code such as you did would be to use the CODE formatting characters which is
{{{
Code here
}}}
I fixed your original post and removed your follow up, hope you don't mind. I will be adding a preview soon!
Jeremy Cowgar
3. Re: [OT] bash script - How do you do this on Windows?
- Posted by Greg Haberek Jul 04, 2008
- 881 views
Wget runs on Windows, too http://gnuwin32.sourceforge.net/packages/wget.htm
-Greg
4. Re: [OT] bash script - How do you do this on Windows?
- Posted by Jerry Story Jul 04, 2008
- 869 views
Wget runs on Windows, too http://gnuwin32.sourceforge.net/packages/wget.htm
-Greg
The problem with that is it requires installation. One more thing to confuse users with.
5. Re: [OT] bash script - How do you do this on Windows?
- Posted by euphoric (admin) Jul 04, 2008
- 856 views
Wget runs on Windows, too http://gnuwin32.sourceforge.net/packages/wget.htm
-Greg
The problem with that is it requires installation. One more thing to confuse users with.
If they are doing an install anyway, you can simply put the wget executable in the same directory as your program.