Soru

Zorluk: ZorBasic Scripting Languages and Constructs

A helpdesk technician is creating an automated maintenance script for newly onboarded macOS and Linux workstations. The script must execute natively within the default Unix shell environment to parse system logs and access environment variables. Which file extension and variable reference syntax should the technician select for a variable named LOG_DIR?

  1. .sh file extension using $LOG_DIR to reference the variableCevap
  2. B
    .bat file extension using %LOG_DIR% to reference the variable
  3. C
    .ps1 file extension using $env:LOG_DIR to reference the variable
  4. D
    .vbs file extension using Dim LOG_DIR to reference the variable

Cevap

The technician should use the .sh file extension and reference the variable using $LOG_DIR.
Unix-based operating systems like macOS and Linux use shell scripts (.sh) interpreted by shells such as Bash or Zsh. In these scripts, variables are referenced using the dollar sign prefix ($LOG_DIR).

Adım Adım Çözüm

1
Identify the targeted operating system environment.
The target operating systems are macOS and Linux.
Scripting environments are operating system dependent.
2
Determine the native shell script file format for Unix-like operating systems.
Unix shell scripts use the .sh extension.
The default command shell (e.g., Bash or Zsh) on Unix-like platforms interprets shell (.sh) scripts natively.
3
Identify the standard variable evaluation syntax for shell scripts.
Variables are declared directly and referenced using a dollar sign prefix (e.g., LOGDIRorLOG_DIR or {LOG_DIR}).
The dollar sign indicates variable expansion in Bash and Zsh.

Anahtar Kavram

Scripting Languages and Syntax Conventions
Bu soruyu puanla