Suppose we define a variable as:File=/dir1/dir2/dir3/my.file.txtDifferent values can be replaced with ${}, respectively:${file#*/}: Delete the first/its left string: dir1/dir2/dir3/my.file.txt${file##*/}: Remove the last/and left string: my.file.txt$
No matter what programming language is inseparable from conditional judgment. The shell is no exception.The approximate format is as follows:If List ThenDo something hereElif List ThenDo another thing hereElseDo something else hereFiAn
Inter-Program Collaboration mode-shell outShell out this noun although not how to hear, but perhaps in silent use, plainly is through a program through the form of a command to invoke another program, that is, System (2) systems call. The existence
After the password expires, change the password to the original password, the server a lot of work, write scripts to complete.After logging in, modify the prompt to: doraemon# convenient expect matchModify Lang=c, prompt for English to prevent
More field servers, password 3 months expired, at the expiry of the need to change the password.Write with expect, try to log in 2 times after the exit (Prevent password error when the account lockout), time-out retry.The shell script calls and
?I. OverviewAfter the successful landing of Linux, the system will appear different cue symbols, such as $,~, #等, and then you can start to enter the required commands. If the command is correct, the system will be executed according to the
Chapter II Shell ProgrammingThe following sections are described in this chapter:What is a shell?Basic ideasSubtle syntax: variables, conditional judgments, and program controlCommand ListFunctionExecution of commands and commandsHere
Tag: Shell time expr wait Shell single, multi, control process use method one, 100 tasks using 200 seconds (normal completion) cat process2.sh #!/bin/bashfunction aaa () { start= ' date "+%s" for ((i=1;iThis article is from the "7928217" blog,
Shell Scripting Learning The shell is the command parser that converts the user-entered instruction into a program that the appropriate machine can run.The shell is a program that acts as an interface between a user and a Linux system, allowing the
Linux shell Programming1) Write a script to complete the user input: 1. First name with 2. Last name, finally shipowner and displayed on the screen: Your full name is: content.1#!/bin/Bash2 #Program:3 # User inputs his first name and last name.
Transferred from: Http://blog.163.com/[email protected]/blog/static/132229655201131055455754/Numeric operations:Only integer arithmetic is provided in bash, and the shell is implemented by the two commands of Let and expr .Use the format: let "x=
If condition judgment
Comparison of Numbers-eq equals if [$a-eq 11]; Then commend Fi-GT Greater than
-lt less than-ge greater than or equal to-lt less than or equal tostring comparison = = string comparison must have a space if [$a = ' yes ']
1, Prophase--The situation is when we get Webshell, we want to leave our back door, this time we can use Msfpayload and msfconsole togetherStart PostgreSQL Service: Service PostgreSQL start start Metasploit Services: Service Metasploit start start
There was a bug when I wrote a shell script recently#!/bin/shRight=disk1PART=${RIGHT//[A-ZA-Z]}Tips:Bad substitutionAt the command-line input, it is running correctly.Checked the next someone said to change SH to bash, found the problem solved.
First, Grep,egrep,fgrep1) grepFormat: grep [options] [mode] [file name]Common options:-N: Display line numbers and matching rows-V: Reverse match-C: No matching rows are displayed, only the number of matching rows is displayed-I: Ignore case-R:
The assignment and operation in the shell is the string processing by default, here are some special methods of mathematical operation in the shell, which can be seen later, hehe1. Examples of error methodsAVar=1+1Echo $varThe result of the output
(EXPRESSION)Expression is true expression true! EXPRESSIONExpression is false expression falseExpression1-a EXPRESSION2Both EXPRESSION1 and EXPRESSION2 are true both trueExpression1-o EXPRESSION2Either EXPRESSION1 or EXPRESSION2 is true one of
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