There are basically three ways to execute shell scripts:
(1) input is directed to the shell script.
The general form is Bash For example, bash (2) Use the script name as the parameter. The general form is:
Bash Script Name [parameter]
For
I have been using Linux recently and have accumulated some experience and skills. I will share it with you.
1. view the number of objects
WC-l filepath
2 File Sorting
Sort-K1-K2-T ""-n-r filepath
The command above is to sort the file
Method 1: send a simple email
Echo "Hello World" | mail-s "subject" yanggang_2050@163.com
Effect
Method 2: send an email in text format
#! /Bin/sh from_name = "from @ Yanggang" from = "yanggang@fruitsmobile.com" to = "yanggang_20
1Three encryption methods are used: shell, embedding, and internal/external combination.
ShellThe so-called shell is the encryption tool added to the encryptedProgram. The shell is first executed when the encryption program starts. Check the
In Windows shell scripts, if you want to use the current date and timeCompositionFile name. You can use the following method:
First obtain the string of the current date and time;
Separate the desired characters;
Finally, splice the file
# Set the dump file size limit. Ulimit-C unlimitedcd/home/linbc/build/bin # Check whether the dump Folder does not exist. If [! -D ../dumpfile] Then ECHO "Create dumpfile fold" Mkdir ../dumpfilefi # Search
My
_ App1: whether it exists
args.txt
#! /Bin/bash if [-Z $1] | [! -E $1] thenecho "Usage: cmd. sh input "exitfiecho $ 0for num in $ *; do echo" $ num "Done For I in $(SEQ-3 $ #); do echo $ I done for I in {0 .. 5} Do echo $ I done echo $ @ for (I = 4; I $ savepathawk '{A [$0]
Linux Shell is a command binder in Linux. It is easy to combine those tools to make a more powerful tool or automate the work at hand.
Batch is also available in windows, and this function is also available in theory. However, its syntax and
Http://www.hickwu.com /? P = 264
C-l clear screen and clear command
C-a move the cursor to the beginning of the lineC-e move the cursor to the end of the row
Delete one character from C-HC-d deletes one character from the forwardC-B move one
Help Command to view help
Help Test
Correct practice:
#! /Bin/sh
String =
If [-z "$ string"]; thenEcho "string is empty"Fi
If [-n "$ string"]; thenEcho "string is not empty"Fi
Root @ James-desktop :~ #./Zerostring. ShString is empty
Logon to Shell
Before calling the init initialization process, the Linux system mainly performs a series of system-level actions. At this time, users cannot use the system because the system does not allow users to control the system!
The
#! /Bin/sh
# Show script description, different colors
Echo-e"\ E[34; 1 m ###################################### ##########\ E[0 m"
Echo-E"\ E[34; 1 m ### format like 'analysis _ log. Sh 2007-07-01 '###\ E[0 m"
Echo-E"\ E[34; 1 m ###
If-fi
#! /Bin/bash # delete a file and create a file file = readme function delfile () { If [-e. /$ file]; then RM-f. /$ FILE echo "del $ file... " fi } function AddFile () { If [! -F. /$ file]; then touch $ file echo "add $ file... " fi }
This article describes how to compile Shell Script. Why shell programming? In LinuxSystem, Although there are a variety of graphical interface tools, token is still a very flexible tool. Shell is not only a collection of commands, but also a
Shell string truncation problem:1. Linux shell intercepts the first eight characters of the character variable by using the following methods:1. expr substr "$ a" 1 82. echo $ a | awk '{print substr (, 1, 8 )}'3. echo $ a | cut-c1-84. echo $5. expr $
Chapter 3 condition statements
Directory
7.1. Introduction to if
7.1.1. Summary
7.1.2. Simple Application of if
7.2. More advanced if usage
7.2.1. if/then/else Structure
7.2.2. if/then/elif/else Structure
7.2.3. if nested statement
7.2.4. boolean
MSSQL differential backup is compared with the previous backup to back up different content. In this way, as long as new content is inserted after the previous backup, differential backup can back up the newly inserted content, and this backup file
In the Linux Shell environment, input and output redirection is supported, expressed by symbols . 0, 1, and 2 indicate the standard input, standard output, and standard error information output, which can be used to specify the standard input or
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.