Use of expr in the shell

The expr command takes an arithmetic expression as a parameter, usually in the following form:expr [number] [operator] [number]Because the shell stores variables as characters, the user must ensure that the operand that participates in the

Shell Learning 5-First shell script

Open a text editor, create a new file, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write a shell script in PHP, the extension is good with PHP.Enter some

Linux Shell: The program PID and occupancy size of swap in statistical system

#!/bin/bash sum=0overall=0for dir in  ' find /proc/ -maxdepth 1 - type d -regex  "^/proc/[0-9]+" ' do    pid= ' echo  $DIR  | cut  -d / -f 3 '     progname= ' ps -p  $PID  -o comm - -no-headers '     for SWAP in  ' grep swap  $DIR/smaps 2>/dev/ null 

Shell exercises-Remote monitoring

design a script that monitors the surviving state of a remote machine (assuming IP 123.23.11.21) and sends a message to yourself when it finds an outage. Tips:1. You can use the ping command ping-c10 www.baidu.com2. The order to send the email is

Shell exercise-count the number of visits per IP?

Download the following log and copy and paste it into your Linux, and then perform a statistical analysis:650) this.width=650; "src=" http://www.apelearn.com/bbs/static/image/filetype/unknown.gif "border=" 0 "class=" VM " Style=

Summary of usage of SEQ in shell

usage: seq [options] ... Mantissa or: seq [options] ... First number mantissa or: seq [options] ... The first number increment mantissa Prints the number to the mantissa starting with the specified increment from the first number.  

Shell Learning 45 days----Xargs

Execute command : XargsWhen find produces a list of files , It is sometimes useful to provide the list to another command .Case :$touch abc.c ERD.C oiy.c$ll./erd.c./abc.c./oiy.c$find-name ' *.c ' | RmRM: missing operandPlease try "rm--help" for more

Shell Scripting Learning notes--functions

I. DEFINITION of format[Function] Function name (){Command table}Ii. Method of InvocationFirst define, then use, direct input function name, no parentheses required ()Three, function parameter transfer methodCan be passed using positional parameters

The use of test in the shell

#/secondin/secondfirstshecho "Please enter the Numseconder"Read FirstRead Secondif test $first-eq $secondThen echo "The No.2″"Elif Test $first-GT $second//Determine if it is greater thanThen echo "The No.2″ >else echo "No.2″ FiExample 2. Find out if

Shell learns 37 days----references

ReferenceCase , If I want to output an asterisk (*), How do i use echo ?echo *This is certainly not possible , need to transfer the * , that is : Echo \*This leads to the concept of references . referenced by , is used to prevent Shell to interpret

Shell Learning Path: Process Control (IF)

1. Single-branch if condition statement1 if [conditional judgment type]; Then 2 program 3fi4 or 5if [conditional judgment]6 then 7 program 8fiPrecautions:The 1.if statement uses the fi end, and the general language uses curly

Shell script checks the memcache process and restarts automatically

Fixed version:#!/bin/sh#check memcache process and restart if downMm_bin= "/usr/local/bin/memcached"Mm_log= "/home/xxx/memcached_check.log"mm_ports= ("11211" "11212")Mm_param= ("-d-m 20480-p 11211-u www" "-d-m 256-p 11212-u www")mm_count=${#mm_ports

Shell Scripting Learning

1.Shell command line writing rules:Multiple commands can be executed on a command line, but required;Long command statements can be expanded with \ on the command line2. Execute Shell Program2.1./test.sh2.2 Bash test.sh2.3 In order to compile and

Shell Learning 1

1.history Save History Command 1000, history-c empty;2.! String calls the most recently used command,! Vim's most recently used vim,! N calls the last Ming ' l,!242 that begins with N to invoke the No. 242 command in history.3.alias Rename, alias h5=

Numerical calculations in the shell

#!/bin/bashecho "Please input number:" Read na= ' expr $n/100 ' #a1 = ' expr $n-$a * b= ' echo ' ($n-$a *100)/10 "| BC ' c= ' echo ' ($n-$a *100-$b *10) "| BC '  d= ' echo ' $c *100+ $b *10+ $a "| BC ' echo $d turn:

The function and library of Shell learning (I.)

Functions are the essence of the shell, and with functions and libraries, the shell handles complex problems as well as the compiler language, gravitated the importance of shell functions and libraries.1 Definition of functionRecommended UseHow to

Shell Run Java/jar Script

1.Shell Execute/Invoke Java/jar program#!/bin/bashjava_home= "$HOME/jdk" base_dir= ' dirname "if [" $BASE _dir "= '. ') Then base_dir= ' pwd ' fiprocess_home= ' dirname $BASE _dir ' my_dir= ' $PROCESS _home/gasarchiveprocess "run_dir=" $MY _dir/

Peanut Shell release Remote management platform intelligent device for real-time monitoring

Beijing time July 1 10:00, peanut Shell (hsk.oray.com) company issued a "Peanut Shell remote Management" platform. This platform is mainly used to manage the embedded peanut shell, such as the embedded management of the peanut shell in the Qnap Nas,

Batch deployment of application system shell scripts (Tomcat/jetty) and tomcatjetty on linux servers

Batch deployment of application system shell scripts (Tomcat/jetty) and tomcatjetty on linux servers Shell script for batch deployment of application systems on linux servers: 1. Replace the server address in the Code (Tomcat or jetty

Shell script [operation expression, conditional control statement]

Shell script [operation expression, conditional control statement] #! /Bin/bash # The four expressions you deserve to add to your favorites. Val1 = 1val2 = 1val3 = 1val4 = 1val5 = 1val6 = 1val7 = 1let val1 ++ (val2 ++) val3 = $ ($ val3 + 1 )) val4 =

Total Pages: 541 1 .... 359 360 361 362 363 .... 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.