[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: the usage of env



On Fri, Jul 19, 2024 at 20:12:14 +0800, pyh@gmx.it wrote:
> for example, what's the difference between '/usr/bin/perl' and 'env
> perl' ?

"env perl" searches your $PATH.

> I know env may set a environment variable in system, so my question also
> includes:

env is used to *display* the current shell environment, or to set a new
environment for *one* specific process.

E.g.

    env FOO=bar ./myprogram

This launches ./myprogram with the additional environment variable FOO
set to the value bar.

> 1. where to see a shell environment variable? I tried 'echo $ENV'
> showing nothing.

Just run env with no arguments.

> the key for perl is "_" in environment variable? under this key, why
> 'env perl' just works?

The _ environment variable is weird.  Please ignore it for now.  You
can live a full and happy life without ever worrying about it.


Reply to: