Skip to main content
InterviewHubPRO
Section Overview
Q5

Question 5 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

10%
Bash & Shell Scripting (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What are the special command-line argument variables (`$0`, `$1`, `$#`, `$@`, `$*`)?

junior Levelbash-shellBasic

In Simple Words: When running ./deploy.sh staging v1.2:

  • $0: The name/path of the executing script itself (./deploy.sh).
  • $1, $2, $3: Positional arguments ($1 = "staging", $2 = "v1.2").
  • $#: Total count of positional arguments passed (2).
  • "$@" (Best Practice): Expands each argument as an individually quoted string ("staging" "v1.2"), preserving arguments with spaces.
  • "$*": Combines all arguments into a single concatenated string separated by the first character of $IFS ("staging v1.2").