Hi all, I have addressed the problem of having one single batch file being executable both under Windows and Linux. Actually I wanted to run the qmake command of QT4, a multiplatform library working under Windows and Linux, from both OSes. I know many can reply that generally you can have two different files, one for each OS, but I started with this goal in mind and then it became a challenge. After trying a bit, playing with the strangest tricks of the two batch languages (bat and bash), I ended up with this solution. It is not very "clear" but it works, even if it has the drawback of printing some instruction (echo off, off, ..) at the beginning. If someone has a nicer solution please do let me know. Ciao, Luca
Batch file: doqmake.bat --------------------------------- echo off echo ; set +v # > NUL echo ; function GOTO { true; } # > NUL GOTO WIN # bash part, replace it to suit your needs qmake -project -nopwd -o $* if [ -e qtoptions.txt ] then cat qtoptions.txt >> $1 fi rm -f Makefile* read -p "Press Enter to continue..." exit 0 :WIN REM win part, replace it to suit your needs ECHO ON qmake -project -nopwd -o %* IF EXIST qtoptions.txt TYPE qtoptions.txt >> %1 IF EXIST Makefile* DEL Makefile* @PAUSE ------------------------------------------------------------------- Luca Citi Ph.D. Candidate, Biorobotic science and engineering IMT - Institutions, Markets, Technologies Lucca Institute for Advanced Studies - Italy Via San Micheletto, 3 55100 Lucca - Italy -------------------------------------------------------------------
_______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash