1.crash Log run-to-collapse positioningDwarfdump--arch=--lookup 0x44b79 .app.dsymAtos-arch o .app/ 0x000235f32.xcode installation path Query and settingsXcode-select-print-path #查询Xcode-select--switch #设置3. View the instruction set of the
$#, the number of arguments followed by the script runtime#! /bin/bashCase ' $# ' in 0) printf "Enter A number: " Read n= $REPLY ;; *) n=$1 ;;EsacX=$ (((1 + $n) * $n/2))echo "Tne value of 1 + 2 + 3....+ $n = $x"The
sudo uname--m View the number of operating system bitssudo uname--s display kernel name ssudo uname--r display kernel versionsudo uname--n display the network host namesudo uname--p display CPUUnder Ubuntu, text files are usually opened with the
$ represents the current process when using the Echo $$ is the PID that will output the current shell1 Echo $$
List of special variables
variables
meaning
$
File name of the current script
1. Declaration of variablesName= "Blacksonny" Note://variable definition does not add $, the variable and equal sign cannot have spaces betweenVariable naming rules:
The first character must be a letter (a-z,a-z).
You can use an
By using the Read command, you can output or perform operations after entering content from the terminal1 #!/bin/bash2#Author: Blacksonny3#Copyright (c)4 #Script follows here: 5 6 Echo " How is old is you ? " 7 Read Age 8 Echo " " $ageThe above
Code: Script_name parameter1 parameter2 Parameter3 ...It's easy to guess that the $ A is the shell script name (path) itself, and $ $ is the first argument, and so on .... you have to pay attention to the role of IFS, that is, if IFS is quoting,
Automatically back up database scripts
#!/bin/bash#auto Bakcup MySQL#by 2015-7-2Bak_dir= "/data/backup/' Date +%y%m%d '"Mysql_db=discuzMysql_user=rootmysql_pw=123456Mysql_cmd=/usr/bin/mysqldumpIf [$UID-ne 0]; Thenecho "must to is use the root
#!/bin/bash#斐波那契数列#不要用递归, the depth is more than 30 old fire. functionfun_test(){if[ $ -lt 3]; Then Echo 1 return fisum1=1Sum2=1 LetCount= $-2sum=0 while[$count -GT 0]; Do Letcount-- LetSum=sum1+sum2 LetSum1=sum2 LetSum2=sum
Method One: Add debugging options when you run the script:"Usage" bash– option./shellscript.sh-e: If a command returns a non-0 exit status value (failed), exit.-N: You do not need to execute the script just to check the syntax structure and return
From Shell13 asked-E: Activate the conversion of the backslash control character (refer to the following table)-e: Turn off anti-skew control character conversion (preset)-N: Cancel line end of line symbol (with the \c character under the-e
Syntax for the FOR loop:1. For variable in value 1 value 2 value 3 ....DoProgramDoneFor example: The following script will print 4 times respectively the value of morning noon afternoon evening1 #!/bin/bash2#打印时间 3#Author mrfeng45 for-time in
When it comes to learning about Linux and OpenStack, it's important to learn scripts well, whether it's a large-scale deployment or operation, and shell scripts are already standard.Here are just some basic notes for the Linux shell, which are noted
Manually enter a line of strings and sort them.The script is as follows:#!/bin/bash#a test about sortEcho "Please input a number list"Read -AArrs for((i=0;i${#arrs [@]}; i++)) { for((j=0;j${#arrs [@]}-1, j + +)) {if[[${arrs[j]} -GT ${arrs[j+1]}]];
Array:A collection of a bunch of variables.Statement:Declare-a ArraynnameEach of these variables is Arrayname[index]Index starts from 0.Assignment value:Arrayname[index] = VALUEArrayname = (VALUE1 VALUE2 ...)Arrayname = ([index1]=value1
Shell Script Programming
#! /Bin/bash # Fibonacci sequence # Do not use recursion. If the depth is greater than 30, it will get old. Function fun_test () {if [$1-lt 3]; then echo 1 return fi sum1 = 1 sum2 = 1 let count = $1-2 sum = 0 while [$ count-
Shell Script Programming
#! /Bin/bash # Fibonacci sequence # Do not use recursion. If the depth is greater than 30, it will get old. Function fun_test () {if [$1-lt 3]; then echo 1 return fi sum1 = 1 sum2 = 1 let count = $1-2 sum = 0 while [$
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