PowerTip: Get the status code of a PowerShell script in Bash


Summary: Identify the results of a script running in Open Source PowerShell in a Bash environment.

Hey, Scripting Guy! Question Is there any way to see the results of a PowerShell script? For example, if somebody sent an “Exit 42”, could I see it in Linux?

Hey, Scripting Guy! Answer All you need to do is examine the $? variable in Linux, just like any other Linux application. Here is an example:

echo $?

The Doctor

Comments (0)

Skip to main content