In practice I found that this script ran so fast (at least for test programs) that it was hard to tell if it had all compiled and lined OK, and even if it hadn't it would run the last generated executable.
So I made a simple mod to buildx.sh inserting a read so that you could review what had happened before any executable was run, and giving you the chance not to run the executable.
It's probably not the neatest bit of shell script - I had to google to find out the basics of how to write one - but it does seem to work. In case anyone is interested here is the modification:
echo done!
echo Do you want to run the compiled code? [Y/n]:
read yesno
if test $yesno = "Y"
then
./$1
fi
if test $yesno = "y"
then
./$1
fi
There's probably a neater way to test for Y or y rather than do 2 tests, but just looking quickly I didn't spot it.
Also you could probably do something smarter with exit codes.
Perhaps someone could help out with a very minor irritation - after running buildx.sh and then my application being launched my terminal screen goes from a nice readable black on white to a fuzzy white on black mode. Going terminal reset fixes that but it would be nice to avoid it altogether. Does anyone know why and how to avoid it, or make the script fix it?
I should add that if the program is not launched at the end of the script then the terminal screen remains how it was.
Thanks
xProgrammer
Just a suggestion re buildx.sh
- xProgrammer
- Posts: 464
- Joined: Tue May 16, 2006 7:47 am
- Location: Australia