PrepAway - Latest Free Exam Questions & Answers

Which of the following is the best way to list all defined shell variables?

Which of the following is the best way to list all defined shell variables?

PrepAway - Latest Free Exam Questions & Answers

A.
env

B.
set

C.
env -a

D.
echo $ENV

Explanation:
A) env – run a program in a modified environment (-a does not exist)
C) option -a does not exist
D) echo $ENV prints the shell variable $ENV if it exists

5 Comments on “Which of the following is the best way to list all defined shell variables?

  1. Chris C says:

    It’s A. not B. Typing env by itself lists all defined shell variables (Smith pg 423) and http://pubs.opengroup.org/onlinepubs/9699919799/utilities/env.html:

    SYNOPSIS

    env [-i] [name=value]… [utility [argument…]]

    DESCRIPTION

    The env utility shall obtain the current environment, modify it according to its arguments, then invoke the utility named by the utility operand with the modified environment.

    Optional arguments shall be passed to utility.

    If no utility operand is specified, the resulting environment shall be written to the standard output, with one name= value pair per line.

    If the first argument is ‘-‘, the results are unspecified.




    0



    0

Leave a Reply