Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Lesson 4 of my Longco operation and maintenance (1)

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Variables for the bash feature:

Variable name: a continuous memory space name.

Variable value: the data stored in the variable name.

Naming rules:

1. Can only start with a letter or "_", cannot use a number, and can be followed by any letter, number, and underscore

two。 Strict distinction between case and case

3. See the name and know the meaning

4. Writing rules:

1) all uppercase

2) Hump style

5. Cannot be the same as a known variable name

Species:

Global variable (environment variable): acts on the entire shell process, including its child shell

Local variable: only acts on the shell of the current login, excluding the child shell

Local variable: acts only as a moneyable program segment, generally used for functions

Default global variables: $?, $#, $*, $@, $$,.

$?: expand the status of the last executed command

$#: position parameters, expressed in decimal system

$*: expand all parameters

$@

$

$0: expand the file name of the shell or shell script

$LANG: storage language

$PS1: command prompt

Use of variables:

Declare a local variable: VARNAME=VALUE

Undo variable: unset VARNAME

Declare the environment variable: export VARNAME

Export VARNAME=VALUE

Declare

-a: declare an indexed array

-A: declare an associative array

-I: declare integer variables

-l: declare variables and convert characters in variable values to lowercase letters

-u: declare variables and convert characters in variable values to uppercase letters

-x: declare variables and make them environment variables everywhere

-r: declare a variable as read-only

View environment variables: export, set, env,

Declare a local variable: local VARNAME=VALUE

To take effect permanently, you need to change the configuration file:

Common configuration files: / etc/bashrc, / etc/profile

Private configuration files: ~ / .bashrc, ~ / .bash_profile

Reload the configuration file: source .bashrc,. .bashrc

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report