[Gambas-user] check 4 Gambas Runtime files?
T Lee Davidson
t.lee.davidson at gmail.com
Wed Dec 13 20:37:09 CET 2017
Yes, but they _can_ be arbitrary for one's own scripts/programs. I've used arbitrary exit codes to debug execve system calls to
my own programs. For published code, the standard should certainly be followed.
On 12/13/2017 01:25 PM, Jussi Lahtinen wrote:
> There is standard for exit codes.
> http://www.tldp.org/LDP/abs/html/exitcodes.html
>
>
> Jussi
>
> On Wed, Dec 13, 2017 at 8:02 PM, T Lee Davidson <t.lee.davidson at gmail.com <mailto:t.lee.davidson at gmail.com>> wrote:
>
> [shell-script]
> #!/bin/bash
>
> which gbx3 &>/dev/null
> if [ $? -ne 0 ]; then
> echo "Gambas runtime (gbx3) not found in path. Cannot continue."
> exit 1 # arbitrary exit code of your choice
> fi
>
> if [[ $(gbx3 -e 'Comp(System.FullVersion, "3.10", gb.Natural) >= 0') == "False" ]]; then
> echo "So sorry."
> exit 2 # also an arbitrary exit code
> fi
>
> # Great, do Gambas stuff now
> [/shell-script]
>
> The line under the "which" statement basically says, "If the exit code from the 'which' command is not equal to zero, then..."
>
>
> Strangely on my system, this prints, "So sorry," even though my package manager says version 3.10.0 of gambas-runtime is
> installed. I have to assume that's an issue with the packager.
>
>
> --
> Lee
>
--
Lee
More information about the User
mailing list