Just some small changes to the linux support .sh scripts
What I did :
At the end of the scripts where $? is checked for errors, I stored $? in a variable named $EXITCODE. the $EXITCODE is checked for its value and if it isn't 0 the error routine is run, then the script exits passing the value of $EXITCODE. The value is stored because 'echo' itself is a command and once it is run, $? wil take the value of echo's exit code. Storing the exit code of the program we are interested in allows us to pass the code back to the operating system.
Why:
There are multiple constructs to run multiple programs on a single command line. The most common are ';' and '&&'
makehex.sh sourcefile.gcb; anothercommand
will run anothercommand immadiately after running makehex.sh
makehex.sh sourcefile.gcb && anothercommand
will run anothercommand only if makehex.sh doesn't exit with an error such as a compiler error.
I have also 'has a go' at adding your post ( above ) to the Help. Can you review/edit the Help page ? https://github.com/GreatCowBASIC/Help/blob/main/source/linuxoverview.adoc You may want to add you insights ( re the $EXITCODE ) to the Help, if you wish. I may have got help incorrect, so forgive me, and hack away! See sectionn === Make ASM, Make HEX and Programming Operations using the provided Linux scripts on the ADOC page.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just some small changes to the linux support .sh scripts
What I did :
At the end of the scripts where $? is checked for errors, I stored $? in a variable named $EXITCODE. the $EXITCODE is checked for its value and if it isn't 0 the error routine is run, then the script exits passing the value of $EXITCODE. The value is stored because 'echo' itself is a command and once it is run, $? wil take the value of echo's exit code. Storing the exit code of the program we are interested in allows us to pass the code back to the operating system.
Why:
There are multiple constructs to run multiple programs on a single command line. The most common are ';' and '&&'
makehex.sh sourcefile.gcb; anothercommand
will run anothercommand immadiately after running makehex.sh
makehex.sh sourcefile.gcb && anothercommand
will run anothercommand only if makehex.sh doesn't exit with an error such as a compiler error.
Edward - thank you.
I have added these scripts to the Gold Build.
I have also 'has a go' at adding your post ( above ) to the Help. Can you review/edit the Help page ? https://github.com/GreatCowBASIC/Help/blob/main/source/linuxoverview.adoc You may want to add you insights ( re the $EXITCODE ) to the Help, if you wish. I may have got help incorrect, so forgive me, and hack away! See sectionn
=== Make ASM, Make HEX and Programming Operations using the provided Linux scripts
on the ADOC page.Help page looks good. Thank you!