Ménahem
Ménahem

Reputation: 11

How to keep some variable with su -?

It is possible to keep some variable when users do "su - xxx" (i know that "-" will erase the environment variable, but i am asking if others solutions or possibilities exists) ?

Thanks !

Upvotes: 0

Views: 2540

Answers (1)

cduffin
cduffin

Reputation: 210

Use -m

eg

su -m xxxx

-m, --preserve-environment
              do not reset environment variables

online manpage with additional information (PATH and IFS might be changed nevertheless)

Upvotes: 2

Related Questions