hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    What is the primary purpose of the $ symbol in Linux shell scripting?
    Question



    What is the primary purpose of the $ symbol in Linux shell scripting?

    A.

    To denote a superuser prompt

    B.

    To reference the value of a variable

    C.

    To execute a command in the background

    D.

    To suppress error messages

    E.

    To concatenate strings

    Correct option is B

    In Linux shell scripting, the $ symbol is used to reference the value of a variable. For example, if a variable is defined as VAR="Hello", the value can be accessed using $VAR. This symbol is essential for variable manipulation and accessing environment variables in scripts.
    Example:

    Important Key Points:
    1. $ references variables, such as user-defined or environment variables (e.g., $HOME, $PATH).
    2. It is also used for special positional parameters in shell scripting, such as $1, $2 for arguments passed to a script.
    3. The $ symbol in the command prompt represents a regular user shell, whereas # is used for the root user shell.
    Knowledge Booster:
    · To denote a superuser prompt: Incorrect; $ is used for normal users, while # is for superuser prompts.
    · To execute a command in the background: Incorrect; the & symbol is used for background execution.
    · To suppress error messages: Incorrect; 2>/dev/null is used to suppress error messages.
    · To concatenate strings: Incorrect; string concatenation is done without any special symbols in Bash.

    Free Tests

    Free
    Must Attempt

    RBI Assistant Pre 2026 Full Mock Test -01

    languageIcon English
    • pdpQsnIcon100 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon60 Mins
    languageIcon English
    Free
    Must Attempt

    RBI Asst Prelims 2026 : Reasoning Section Test 01

    languageIcon English
    • pdpQsnIcon35 Questions
    • pdpsheetsIcon35 Marks
    • timerIcon20 Mins
    languageIcon English
    Free
    Must Attempt

    RBI Asst Prelims 2026 : Quant Section Test 01

    languageIcon English
    • pdpQsnIcon35 Questions
    • pdpsheetsIcon35 Marks
    • timerIcon20 Mins
    languageIcon English
    test-prime-package

    Access ‘IBPS SO IT Officer’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    346k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow