A shell program that replaces a section of a line near a keyword in a text file:
#!/bin/bash file=$1 findpattern=$2 linegap=$3 replacepattern=$4 substitue=$5 Help () {echo Help:echo \$1:file\ ' s full Path \ (include filename\) echo \$2:the key
Both exec and source belong to the Bash Internal command (builtins commands), where you can view all the internal command information by entering man exec or man source under bash.
The bash shell commands are divided into two categories: external
First, what is the shell?
The shell is a scripting language aming_linux blog.lishiming.net
You can use logical judgments, loops, and other syntax
Functions can be custom-defined
The shell is a collection of system commands
Shell scripts
Installation of the zsh bodyFirst chsh -l , look at the current bash situation, as follows: If it is CentOS, use yum install -y zsh to install ZSH, zsh and then installed oh my zsh , using the Wget method to install wget
When scripting is often written in operations, most people first think of using "-eq" for comparisons when using variables intermittently, but in fact if the variable value is null (NULL) for a special reason, bash shell converts null to 0 for "-eq"
Login Shell: A full login process is required to go to bash. That is, by entering the account and password to log into the system, the obtained shell is called the login shellnon-login Shell: The method of obtaining the Sbash interface does not
Many programs impose some logical control processes on the commands in shell scripts.Structured commands allow you to change the order in which programs are executed. It's not necessarily in sequence.12.1 using the If-then statementThe following
The function of the DF command in Inux is used to check the disk space usage of the Linux server's file system. You can use this command to get information about how much space the hard disk is taking up, and how much space is left.1. Command
Execute shell command in PythonThe previous execution of the shell command is mostly done by Os.system (Shell command), which is more cumbersome.Understand that SH is a better library than subprocess, capable of executing shell commands1. View
To write a program that imports data in batches, learn to write shell scripts! Now learn to use!============================================1, the first simple for loop#!/bin/bashFor I in 1 2 3 4;Doecho $i;Done2. Test for self-growing
Background: I have summed up some knowledge points about my common shell scripting style. Also as part of the handover work document. Part of the content is written separately#!/bin/sh# Shell Script Advanced Tutorial # 1. Common knowledge Points:
Echo-e "\033[32;49;1m [done] \033[39;49;0m"Output Result:[Done] The color of the text terminal can be generated by using the ANSI unconventional character sequence. Example:Echo-e "\033[44;37;5m ME \033[0m COOL"The above command sets the background
Special Shell variables
Test operation: Two Yuan comparison
Arithmetic comparison
string comparison
File type operations
Parameter substitution and extension
String manipulation
Summary of
Functions in the shellThe 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}The function has to be on the
File Transfer
The biggest problem with the CMD shell obtained by the overflow vulnerability is how to upload files. Due to the prevalence of worms, ports 139 or 445 required to connect to IPC $ are blocked by routes. In addition, the WINXP system
Shell syntax error: unexpected end of file error message
if [ -n "$1" ]then echo "111"else echo "222"fiexit 0
Execute sh my. Sh par and prompt syntax error: unexpected end of file. Why?
Text editing is a file written in notepad in windows and runs
1. shell script execution Method
There are two ways to execute shell scripts. One is to generate a new shell and then execute the corresponding shell scripts. The other is to execute the shell in the current shell and no longer enable other
In Linux, you can specify an alias for an alias command: in Linux, if the command is too long and does not conform to the user's habits, you can specify an alias for it. Although you can create a "Link" for a command to solve the problem of long
For example, to compare strings, determine whether a file exists, and whether the file is readable, "[]" is usually used to represent a conditional test.
Note: spaces are important. Make sure that the square brackets have spaces. I used to waste a
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service