• Ogłoszenie:

What does 'env' command do?

Dyskusje i problemy z Unix'ami

What does 'env' command do?

Postprzez TeetharKehar 14 Lip 2023, 11:33

reklama
The "man env" documentation provides the following information:

When "env" is used with a single hyphen (-), it implies the -i option. If no COMMAND is specified, it prints the resulting environment.

In other commands like "tar," the hyphen can mean different things depending on its placement, such as "read from STDIN" or "write to STDOUT." However, it is unclear how that applies to "env."

To clarify the behavior of "env," here are a few examples:

Using "env -iv TQ1=Bazinga":

"cleaning environ" clears the current environment.
"setenv: TQ1=Bazinga" sets the TQ1 variable to "Bazinga."
"TQ1=Bazinga" confirms the value of the TQ1 variable.
Using "env -v - TQ1=Bazinga":

"cleaning environ" clears the current environment.
"setenv: TQ1=Bazinga" sets the TQ1 variable to "Bazinga."
"TQ1=Bazinga" confirms the value of the TQ1 variable.
Using "env -v - TQ1=Bazinga perl -E 'say "TQ1 := $ENV{TQ1}"'":

"cleaning environ" clears the current environment.
"setenv: TQ1=Bazinga" sets the TQ1 variable to "Bazinga."
"executing: perl" indicates the execution of the Perl command that follows.
The Perl command retrieves the value of TQ1 from the environment and prints it.
Using "env -iv TQ1=Bazinga perl -E 'say "TQ1 := $ENV{TQ1}"'":

"cleaning environ" clears the current environment.
"setenv: TQ1=Bazinga" sets the TQ1 variable to "Bazinga."
"executing: perl" indicates the execution of the Perl command that follows.
The Perl command retrieves the value of TQ1 from the environment and prints it.
These examples demonstrate the behavior of "env" with different options and command configurations. The -i option clears the environment, and the -v option provides verbose output during execution. The subsequent commands, such as "perl -E 'say "TQ1 := $ENV{TQ1}"'", execute with the given environment variables in place.

Please note that further clarification or additional examples may be available in the omeglz online2yu official documentation or specific man pages related to your operating system.
TeetharKehar
~user
 
Posty: 24
Dołączenie: 02 Sty 2023, 12:06



Powróć do System Linux / Unix

Kto jest na forum

Użytkownicy przeglądający to forum: hunain333, nesteroid, tayero oraz 5 gości