!! Executes the previous command!cat executes the most recent command that starts with catCat!$ Execute command, above one command last parameter defines alias for parameter aliasUnalias aliases alias alias is valid only in the current environment,
The shell is executed in sequence according to the script command.#!/bin/bash or #!/bin/sh /bin/sh is a soft link to/bin/bash# #描述信息ls/etc/echo "This is a test script"Wq save exit, file name test.sh not necessarily. Sh end, mainly for the sake of
During script execution, if there are some commands or paths that are long and need to be used repeatedly. Variables are used instead, which makes it easy to change and maintain.Read-t3-p "Please input a number:" NEcho $nRead is commonly used to
For loop with 1 2 3 4 5do echo "The value is: $loop" (double quotes and no quotes are OK, single quotes do not work, output $loop) done results:The value is:1The value Is:2The value Is:3The value Is:4The value Is:5
Similar to other programming languages, the shell supports A for loop.The general format for A for loop is: for inch List Do command1 command2 ... CommandN DoneA list is a sequence of values (numbers, strings, and so on), each separated
Strings can be in single or double quotes, or without quotation marks.Single quotation marksstr='This isa string'Single-Quote String restrictions:1. Any character in a single quotation mark is output as is, and the variable in the single-quote
Arithmetic operatorsNative bash does not support simple math operations, but can be implemented with other commands, such as awk and expr,expr, which are most commonly used.Expr is an expression evaluation tool that uses it to perform evaluation
1.Bash variablesUser-defined variables #局部变量environment variable #全局变量Positional parameter variablesPre-defined variablesX=val #赋值$x #调用Variable defaults to character type and cannot be directly calculated"$x" ${x} variable overlay, that is, the
1. Shell to determine the file, whether the directory exists or has permissions2. #!/bin/sh3.4. Mypath= "/var/log/httpd/"5. myfile= "/var/log/httpd/access.log"6.7. # the-x parameter here determines whether the $mypath exists and has executable
has been learning, but also has been forgotten, today with the help of this blog post, to record their own learning process some of the most basic things!1. For#!/bin/bashfor i in {1..10}do echo $idoneScan the active IP in the target network segment#
Write a small script to calculate how many days you have for your birthday.#!/bin/bash# Enter your birthday date, calculate how many days you have birthday # 2015 July 20 read -p "Please enter your birthday date (YYYYMMDD): " date1date_d=$ (echo
The operation of commands is analyzed and run from top to bottom, from left to right.
The order is released as mentioned in the fifth chapter: multiple blanks between commands, options, and parameters are ignored;
Blank lines are also
Transferred from: http://blog.sina.com.cn/s/blog_464f6dba0100psy9.htmlVariable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return value)$-Flag at a
wrote a script to automatically generate PDF uploads GitHub can't stand every time the same commit decides to use a script to pass the argumentSimple and easy to use bold method, more complex can refer to the following two detailed.How to pass
1. Command history:By pressing the UP ARROW key, you can traverse backward through the most recently entered command under the console, and by pressing the DOWN ARROW key, you can traverse the command you recently entered under the console.You can
Bash supports one-dimensional arrays and does not qualify the size of the array, and the subscript of the array element is numbered starting with 0.Defining arraysIn the shell, the array is represented by parentheses, and the elements of the array
Fly2015I love cracking training first elective homework 5 practice procedures, in the company when using the tulip OD Debugging the shell program when there is a problem, but home with my love cracked version of od a debugging, all body spirit cool,
Special variable IFS in shell
As I get used to the writing style of python, I often want to use bash to traverse the lines of a file and process the lines read.
But in a strange situation, if my text is similar to this
The first line.The second
Shell-automatically deploy war packages to tomcat and shell-tomcat#! /Bin/shCURL = $1CRootDir =/data/tomcat-usercenterShRootDir =/data/tomcat/dll# Delete old versionRm-rf $ shRootDir/usercenter-web.war *# The default war package address is the last
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