Shell Common Commands

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

Introduction to shell-related directives

$#, 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

Linux Shell Simple Commands

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

Special variables in the shell

$ 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

Use of variables in the shell

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

Shell input and output

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

In the shell, we can use $ A, $, $, $ ... This variable extracts the variables in the command line

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,

Shell Script (iii)

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

Shell Script Programming Chapter

#!/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

Linux Shell Program Debugging

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

Shell Basic Learning

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

Shell Pull Process

#!/bin/shMm= ' Ps-ef|grep memcached|grep-v grep|wc-l 'While ["$MM"-eq 0]Doecho "$ (date +%y%m%d%h%m%s), the memcached is down,try to up it" >>/data/shell/men.log/usr/bin/memcached-d-u root-m 512-p 39999-c 1024Sleep 2sMm= ' Ps-ef|grep

Shell Learning Path: Process Control (for)

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

Shell Script (ii)

1.Until Loop statement#!/bin/basha=10;until [[$a-lt 0]];d oecho $a;((a--));d one;2.case Selection Statement#!/bin/bash#auto install lamp#by 2015-6-30case $1 in          apache ) echo  "Wait for install httpd server ..." yum  install http* -y;;       

Basics of Linux Shell learning

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

Shell script Implementation Bubble sort

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 of shell scripts

#!/bin/bash#你必须知道的shell里面关于数组的操作. Arr= ("Hello" "word" "You" "is" "a" "Good" "Boy.")#arr = (' ls ') #我喜欢这个方法. Echo "-------for----------------" forIinch ${arr[@]} Do Echo $I DoneEcho "--------for---------------" for((i=0;i${#arr [@]}; i++)) {Echo

Array of shell scripts

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

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

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 [$

Total Pages: 541 1 .... 472 473 474 475 476 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.