adb Shell common commands:
Press the OK Key device.press (' Keycode_dpad_center ', ' down_and_up ')
Long Press a key: Device.drag ((236,440), (236,440), 2,10)
The corresponding keys correspond to the following names:
HOME key:
How shell scripts run$sh script.sh$sh/home/path/script.sh$chmod a+x script.sh; $./script.shEcho's three ways to use echo Hello World Cannot contain some special keywords, such as semicolons;echo "Hello word" Cannot contain some special characters,
#!/bin/bash while:do neterror=$ (/bin/netstat-a | GREP-CW "close_wait") echo "Get TCP netstate ' LISTEN ' num ber cuccessful! " echo "Neterror" $neterror if [$neterror-gt "]; then echo" too much net Error,system would reboot
1.5 using the shell for mathematical operationsIn any programming language, arithmetic operations are essential, and the shell is no exception.1.5.1 arithmetic operations using Let, (()), and []
You can use the normal variable assignment
Tenth lineHow would you print just the 10th line of a file?For example, assume. has the file.txt following content:Line 1Line 2Line 3Line 4Line 5Line 6Line 7Line 8Line 9Line 10Your script should output the tenth line, which is:Line 10[Show hint]Hint:
If flow control:Conditional judgment statements in the shell are similar to other programming languages.If you need to know what the criteria are, you can get help with man testCommon formatsFormat Oneif condition; ThenStatementFiFormat Twoif
Test command usage:1) Judgment expressionif test (expression is true)if test! An expression is falsetest expression 1–a expression 22 expressions are truetest expression 1–o expression 22 expressions have a true2) Judging the stringtest–n String
#!/bin/bash## 1, check whether the current user's identity has permissions# 2, check if there is a Yum source, if there is no need to create a Yum source configuration file# 3, install DHCP, if already installed, we can first remove and then install,
1, log structure/opt/online/{123com,abccom}/log/online[1-9]/[a-z]2, variable description # Whether to turn on the compression function (0: OFF, 1: on; If the compression function is turned off, the Compressdayn is not valid) Needcompress=1 Delete 14
Using the Unix/linux system UUID file to intercept the partial generation of random numbers, and in order to prevent the renaming process may already exist and the new random directory with the same name of a sub-directory, that is, the renaming
Remember this is the original play Cdlinux when, originally should be because of windows under the UltraISO to Cdlinux mirror changes cause the image can not boot, so use the command under Linux to operateThis should be the command to mount the ISO
The default value in the shell is decimal, so how are binary, octal, and hexadecimal represented?Method 1: Use the prefix.0 begins with octal, and 0x starts with hexadecimal.As follows:#-----------------------------/chapter4/ex4-35.sh----------------
There are several ways to execute the shell script1, relative path mode, you need to first CD to the script path[[email protected] tmp]# Cd/tmp[[email protected] tmp]#./ceshi.sh Script Execution succeeded2. Absolute path mode[[email protected] tmp]#/
Today, when we look at the/etc/init.d/nginx script, we find that there is a lot of behavior in the script (the space name of the dot). For example, a few lines of file start:if [-r/etc/default/nginx]; Then
1. #注释作用, #! Except in addition, in the parameter replacement echo ${path#*:} here does not represent the comment, the numeral conversion, does not represent the comment echo $ ((2#101011)) 2. Command line delimiter, you can write multiple commands
Linux learning-advanced shell script programming (2) first recognized by sed, gawk, and sedgawk
Citation: Sometimes we need to automatically process text in text files without pulling out a fully armed interactive text editor. In this case, it is
Several methods of shell script executionYou can execute shell scripts in the following ways:
1. The relative path method must be cd to the script path first.
[Root @ banking tmp] # cd/tmp [root @ banking tmp] #./ceshi. sh script executed
[Linux] shell multi-process concurrency-version details, linuxshell Business background
The schedule. sh script schedules the execution of the user's trajectory project script. Part of the Code is as follows:
#! /Bin/bashsource/etc/profile; export
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