asked 169k views
5 votes
Which of the following commands allows definition and assignment of environment variables under bash?

1) env
2) export
3) environ
4) None of the above

1 Answer

3 votes

Final answer:

The 'export' command is used to define and assign environment variables in bash, making them accessible to subprocesses initiated from the shell.

Step-by-step explanation:

The command that allows the definition and assignment of environment variables under bash is export. Using the export command, you can set an environment variable with the syntax export VARNAME="value". It not only defines the variable but also makes it available to subprocesses started from the bash shell. The env command, on the other hand, can be used to run a program in a modified environment, but does not by itself define a new environment variable.

answered
User Tim Lum
by
7.6k points