A tier-2 helpdesk technician is auditing cross-platform system maintenance scripts used across Windows and Linux endpoints. The technician needs to verify the syntax rules for variable declaration and environment variable usage in these scripts. Which of the following statements correctly describe variable handling in PowerShell (.ps1) and Bash shell (.sh) scripts? (Select TWO).
- PowerShell scripts require a dollar sign prefix ($) when defining user variables and accessing environment variables.Answer
- BBash shell scripts require a dollar sign prefix ($) both when assigning values to variables and when referencing them.
- Bash shell scripts assign values to variables without a leading symbol, but require a dollar sign ($) prefix to reference their contents.Answer
- DPowerShell scripts enclose environment variable names between percent signs (%) to evaluate their values.
Answer
PowerShell scripts use a dollar sign prefix () to evaluate or reference them.
PowerShell requires a dollar sign ( env:Path). In contrast, Bash shell scripts assign values to variables without a prefix (e.g., VAR=value) and require the dollar sign ( VAR).
Step-by-Step Solution
Key Concept
Variable Declaration and Syntax Rules in Scripting Languages
Estimated Time:1m 30s