This article mainly introduces the Linux Shell Script series (i): Introduction to the shell, this article explains the shell introduction, Shell basic operations, how to open the shell terminal,
# And for common users, it is $
PS2: A subsidiary prompt. The default value is "> ". You can modify the environment variable to modify the current command string.
Location variable:
$1, $2,... $ n
Special variables:
$? : Return Value of the execution status of the previous command. If the echo $0 result is 0, it indicates success, and if it is not 0, it indicates failure.
$0: get the name of the currently executed shell
Call another script in shell script
Bash shell commands are divided into two types: External commands and Internal commands. External commands are implemented through system calls or independent programs, such as SED and awk. Internal commands are implemented by special file formats (. Def), such as CD, history, and ex
在study(Shell)专栏中,会深刻学习到shell编程And as an OPS person, the most basic ability is to learn shell script programmingTo improve efficiency in our work!Shell Programming:Compiler: Also called interpreterThe shell provides us with another
Fork (/directory/script.sh): If the shell contains execution commands, then the subcommand does not affect the parent's commands, and then executes the parent command after the subcommands have finished executing. The children's environment variables do not affect the parent level. Fork is the most common, is directly in the script with/directory/script.sh to call script.sh this script.run the time to open
Tags: chm use language days ago script structure without a $# direct20.1 Shell Script IntroductionWhat is a shell?
Shell is a scripting language
You can use logical judgments, loops, and other syntax
Functions can be custom-defined
The
Shell scriptGetting started with programming learning is what we will introduce in this article. We can use any text editor, such as gedit, kedit, emacs, vi, etc.Shell scriptIt must start with the following line and be placed in the first line of the file ):
#!/bin/sh...
Note: It is best to use "! /Bin/bash "instead of"! /Bin/sh ", if you use tc shell to change to tcsh, others are similar.
Symbol #! Used to
Shell Script Introduction
Shell is a scripting language
You can use logical judgments, loops, and other syntax
Functions can be custom-defined
The shell is a collection of system commands
Shell scripts enable automated operations, which can greatly i
administrative files are text files that can be edited directly, most of which are in the standard directory:/etc. We write shell scripts most of the time are processing text information, and the pipeline can be used in order to be connected to the use of ... ... | ... In this way, the book has an example of a passwd file with 5 tubes attached to it. Then a script was written to convert the text into an HT
Original link: http://blog.chinaunix.net/uid-22548820-id-3181798.html
Fork (/directory/script.sh): If the shell contains execution commands, the subcommands do not affect the parent's commands. When the subcommand executes and then executes the parent command, the child's environment variable does not affect the parent .
Fork is the most common, is directly in the script with/directory/script.
Linux (7) _ shell script programming, __shell Script Programming
I. What is a shell script?
In addition to a command interpreter, shell is also a programming language. A program written in she
Shell script learning notes ----- command execution, script learning notes
1. PATH variable: the main function of shell is to execute the command entered by the user. For example, after the user inputs a "ls" command, the shell will find the file corresponding to the command
Bash shell Script Introduction Shell Runtime EnvironmentIf you're running a Unix or Linux system, such as Ubuntu,red Hat,suse Linux and MacOS, it's built-in bash shell, so you don't need to configure the so-called development environment.My shell environment is the MacOS Sie
Functions in a shell script
The function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly.
Format:function F_name () {Command
}Functions must be placed at the front, function can omit the direct write function name
Show Column 1, print the shell
1. I wrote a php script to execute some shell scripts through the WEB interface. shell script will use sudo3.sudo user has set NOPASSWORD4. manually in the nobody user environment, (su-sbinbashnobody), and then execute shell script
There are several ways to execute a shell script
1, relative path mode, need to first CD to script path
Copy Code code as follows:
[Root@banking tmp]# Cd/tmp
[Root@banking tmp]#./ceshi.sh
Script execution succeeded
2. Absolute path mode
Copy Code code as follows:
[Root@banki
Open a text editor (you can use the Vi/vim command to create a file), a new file test.sh, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write Shell script in PHP, the extension is good for PHP.
Enter some code, the first line is usually this:
#
Open the text editor and create a new file with the extension SH (SH stands for shell). The extension does not affect script execution. If you use PHP to write shell scripts, PHP is enough for the extension.Enter some code:
1 #!/bin/bash2 echo "Hello World !"View code
"#!" Is an agreed tag, which tells the system what interpreter is required to execute this
Linux Shell script programming learning notes and practice, Script Programming learning notes
Http://www.1987.name/141.html
Shell Basics
Terminal printing, arithmetic operations, common variables
Search for specific strings in a specified directory in Linux and highlight matching keywords
Obtain the standard input
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.