VPS και αποκλειστικοί server (Κέντρο ελέγχου φιλοξενίας) Βοήθεια

How to read and set environment variables in CentOS

Environment variables are a set of dynamic variables that are part of the operating environment for UNIX-like operating systems such as CentOS. These variables affect the behavior of processes that run in that operating system. For example, the TEMP environment variable specifies a suitable location for storing temporary files. Environment variables are set to initial values when you log in to your shell, but you can also change them during the logon session. Displaying and changing environment variables is a routine task that all CentOS users should be able to perform.

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
RELATED PRODUCTS CentOS-based VPS or dedicated servers

Here is a quick tutorial on how to read and set environment variables.

Read Environment Variables

Several commands can display the environment variables in CentOS.

The env command allows you to export an environment, often for the purpose of modifying the environment for a particular program. This command produces the following output:

The set command prints the name and value of each environment variable, and produces this output:

The printenv command also prints the environment variables.

You can also read the value of a specific variable with the echo command:

echo $TEST

In this example, TEST is the variable name.

Set Environment Variables

Set an environment variable with the export command:

export TEST=1

In this example, TEST is the variable name and 1 is the value to which TEST will be set.

Ήταν χρήσιμο αυτό το άρθρο;
Σας ευχαριστούμε για τα σχόλια. Για να μιλήσετε με έναν εκπρόσωπο της εξυπηρέτησης πελατών, χρησιμοποιήστε τον αριθμό τηλεφώνου υποστήριξης ή την παραπάνω επιλογή συνομιλίας.
Χαιρόμαστε που βοηθήσαμε! Υπάρχει κάτι άλλο που μπορούμε να κάνουμε για εσάς;
Λυπούμαστε. Πείτε μας τι σας μπέρδεψε ή γιατί η λύση δεν ήταν αποτελεσματική για το πρόβλημά σας.