La commande 'printenv' affiche le contenu d'une variable ou l'ensemble des variables d'environnement et leur valeur.

La syntaxe est donnée ci-dessous.

 

printenv Command

Purpose

Displays the values of environment variables.

Syntax

printenvName ]

Description

The printenv command displays the values of environment variables. If you specify the Name parameter, the system only prints the value associated with the Name parameter. If you do not specify the Name parameter, the printenv command displays the current environment, showing one Name = Value sequence per line.

If you specify a Name parameter that you have not defined in the environment, the printenv command returns an exit status of 1; otherwise it returns a status of 0 (zero).

Examples

  1. To find the current setting of the MAILMSG environment variable, enter:
    printenv MAILMSG
  2. The command returns the value of the MAILMSG environment variable. For example:
    YOU HAVE NEW MAIL
icon phone
Téléphone/Whatsapp : +33 (0)6 83 84 85 74
icon phone