在windows中设置Tesseract OCR环境变量 setenv设置环境变量_shell


setenv设置环境变量

Linux and Unix ecosystem mainly used command line based. While working with command line and C Shell we generally need some values to use with commands. Shells provide environment variables for this. This environment variables can be managed with setenv command like add, change and remove.

Linux和Unix生态系统主要使用基于命令行的。 在使用命令行和C Shell时,我们通常需要一些值才能与命令一起使用。 外壳为此提供了环境变量。 可以使用setenv命令(例如添加,更改和删除)来管理此环境变量。

(Syntax)

Syntax of setenv command is very simple we just need to provide the variable name and data

setenv命令的语法非常简单,我们只需要提供变量名称和数据

setenv VARIABLENAME DATA

(List All Environment Variables)

We can use setenv in order to list all environment variables currently defined in C Shell.

我们可以使用setenv来列出C Shell中当前定义的所有环境变量。

$ setenv


在windows中设置Tesseract OCR环境变量 setenv设置环境变量_go_02

List All Environment Variables 列出所有环境变量

添加环境变量(Add Environment Variable)

We will start by creating come environment variable and setting some data to it. We can use lowercase or uppercase letters bu the general usage is uppercase letters. In this case we will create a variable named MYIP and set value 192.168.1.10

我们将首先创建环境变量并为其设置一些数据。 我们可以使用小写或大写字母,一般用法是大写字母。 在这种情况下,我们将创建一个名为MYIP的变量,并将其值设置为192.168.1.10

$ setenv MYIP 192.168.1.10

(Print Environment Variable)

We can print specific environment variable with echo command. We will provide the environment variable and and prefix with $ . In this example we will print environment variable named MYIP like below.

我们可以使用echo命令打印特定的环境变量。 我们将提供环境变量and并带有$前缀。 在此示例中,我们将如下打印名为MYIP环境变量。

$ echo $MYIP


在windows中设置Tesseract OCR环境变量 setenv设置环境变量_go_03

Print Environment Variable 打印环境变量

将环境变量传递给子外壳或子外壳(Pass Environment Variables To Sub or Child Shell)

Linux process and shell architecture provides the ability to run sub process or shell. Sub process and shell will create a new environment. If we need to use current environment variables in the sub process or shell we just need to use them accordingly. For example in the following example we will print previously defined MYIP in the bash sub-shell.

Linux进程和Shell体系结构提供了运行子进程或Shell的能力。 子进程和shell将创建一个新环境。 如果我们需要在子进程或shell中使用当前环境变量,我们只需要相应地使用它们即可。 例如,在以下示例中,我们将在bash子外壳中打印先前定义的MYIP

$ echo $MYIP


在windows中设置Tesseract OCR环境变量 setenv设置环境变量_go_04

Pass Environment Variables To Sub or Child Shell 将环境变量传递给子外壳或子外壳

设置或更新一个环境变量值(Set OR Update One Environment Variable Value)

After assigning a value to a environment variable we may need to update it with new value. We can use set command in order to update current environment variable with a new value. In this example we will update our variable MYIP with 192.168.1.20

将值分配给环境变量后,我们可能需要使用新值对其进行更新。 我们可以使用set命令来用新值更新当前环境变量。 在此示例中,我们将使用192.168.1.20更新变量MYIP。

$ set MYIP=192.168.1.20


在windows中设置Tesseract OCR环境变量 setenv设置环境变量_shell_05

Set OR Update One Environment Variable Value  设置或更新一个环境变量值

有用的环境变量(Useful Environment Variables)

There are a lot of default enviroment variables. Here are some of them.

有很多默认环境变量。 这里是其中的一些。

  • USER stores current user name
    USER存储当前用户名
  • PWD current working directory
    PWD当前工作目录
  • SSH_CLIENT the ssh client IP address with source and destination port numbers
    SSH_CLIENT带有源和目标端口号的ssh客户端IP地址
  • SHELL current shell
    SHELL当前外壳

LEARN MORE  Linux Tee Command Tutorial with Examples For Stdout Management


了解更多Linux Tee命令教程,以及有关Stdout管理的示例


翻译自: https://www.poftut.com/setenv-command-tutorial-to-add-delete-and-change-environment-variables-in-linux/

setenv设置环境变量