November 11th, 2016

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

Doctor Scripto
Scripter

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

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback