When a PowerShell script ends, you can run the command “Exit” and submit a numeric value. This has been good practice in the Windows world to set the “Error Level” that can be read by the caller (for example, a batch file or the scheduled task manager).
exit 99
Now that PowerShell is available on Linux as well, it can also be used to report back a status number to the calling Linux process.