Bird
0
0

What will be the output of this PowerShell command run on macOS terminal?

medium📝 Command Output Q13 of 15
PowerShell - Cross-Platform PowerShell
What will be the output of this PowerShell command run on macOS terminal?
pwsh -Command "Write-Output 'Hello macOS'"
AHello macOS
BWrite-Output 'Hello macOS'
Cpwsh: command not found
DError: Invalid command
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command structure

    The command uses pwsh -Command to run a PowerShell command inline, which outputs the string 'Hello macOS'.
  2. Step 2: Predict the output

    The Write-Output cmdlet prints the string to the terminal, so the output will be exactly 'Hello macOS'.
  3. Final Answer:

    Hello macOS -> Option A
  4. Quick Check:

    Write-Output prints text to terminal [OK]
Quick Trick: Write-Output prints text; expect exact string output [OK]
Common Mistakes:
  • Confusing command string with output
  • Assuming 'pwsh' is not installed
  • Expecting error due to quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes