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

What are the internal commands of Shell programming bash in Linux

2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly shows you "what are the internal commands of Shell programming bash in Linux", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn what are the internal commands of Shell programming bash in Linux.

The bash command interpreter suite contains some internal commands. Internal commands are not visible in the directory list, and they are provided by Shell itself. Common internal commands are: echo, eval, exec, export, readonly, read, shift, wait and dot (.).

1.echo

Command format: echo arg

Function: the string specified by arg is displayed on the screen.

2.eval

Command format: eval args

Function: when the Shell program executes the eval statement, Shell reads in the parameter args, combines them into a new command, and then executes.

3.exec

Command format: exec command parameter

Function: when Shell executes the exec statement, it does not create a new child process, but instead executes the specified command. When the specified command is executed, the process (that is, the original Shell) is terminated, so the following statements of exec in the Shell program will no longer be executed.

4.export

Command format: export variable name or: export variable name = variable value

Function: Shell can use export to bring its variables down into the child Shell, thus allowing the child process to inherit the environment variables in the parent process. But the child Shell cannot use export to bring its variables up into the parent Shell.

Note: export statements without any variable names will display all current export variables.

5.readonly

Command format: readonly variable name

Function: identifies a user-defined Shell variable as immutable. The readonly command with no arguments displays all read-only Shell variables.

6.read

Command format: read variable name table

Function: read a line from a standard input device, decompose it into several words, and assign values to variables defined within the Shell program.

7.shift statement

Function: the shift statement renames all positional variables in the following way, that is, $2 becomes $1 and 3 becomes $2. Each time the shift statement is used in the program, all the position parameters are moved one position to the left in turn, and the position parameter $# minus 1 until it is reduced to 0.

8.wait

Function: make Shell wait for the end of all child processes started in the background. The return value of wait is always true.

9.exit

Function: exit the Shell program. After exit, you can optionally specify a digit as the return state.

10. "(dot)

Command format:. Shell program file name

Function: make Shell read into the specified Shell program file and execute all the statements in the file in turn.

These are all the contents of the article "what are the internal commands for Shell programming bash in Linux?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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: 286

*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

Servers

Wechat

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

12
Report