Shell variables:(1) The variable and the variable content are connected with the equal sign "=;(2) The equal signs cannot be directly followed by space characters;(3) The variable name can only contain English letters and numbers, but cannot start
Must begin #! /Bin/sh start
Start a line of comment #
$ # Indicates the number of parameters input by the script
$1, $2,... indicates 1st parameters, 2nd parameters ,...
Shift is used to move the $ n parameter to the next parameter, which is
First, let's talk about the basic idea of shell sorting: First take an integer D1 less than N as the first increment, and divide all the records of the file into D1 groups. All records whose distance is a multiple of DL are placed in the same group.
Sed (a stream editor)
Four spaces: input stream, pattern buffer, output stream, and hold BufferThe basic operation process is:(1) Put the current row of the input stream into the pattern buffer, and then the pointer of the input stream points to
Shell scripting is an interpreted language;
The essence of shell scripts is an ordered set of shell commands;
1. Basic shell programming process
1) create a shell file
2) grant executable permissions to chmod A + x filename
3) execute the shell file.
Based on the tutorials on the official website, the test is available.
Note that you must use the root permission to run the task.
#!/bin/bash# This script run the init command for opotimus pc;# Fedora 19;# run as the rootecho 'run as the root'yum
You can use the am command to start an existing app in the system in the command line mode.
The ADB shell enters the command line.
Press enter to view the help information about AM.
The meaning of each parameter is not described here. Just give a
Chapter 2: handling user input
Command Line ParametersRead ParametersBASH Shell assigns some special variables called positional parameter to all the parameters entered by the command line.Even include the program name$0: Program name (Absolute
Chapter 2: using structured commands
Use the if-then statement
if commandthen commandsfi
If the exit status code of the command after if is 0, execute then.
Another Form
if command; then commandsfi
If-then-else statement
if commandthen
Shell sorting is a form of change in insert sorting. Because insert sorting compares each element and compares the current element with all the previous elements, in the worst case. Therefore, DL. shell proposed shell sorting in 1959, that is,
Some terminal shortcut keys:
CTRL + F
Forward one character
CTRL + B
Move one character behind
CTRL + E
Move to end of line
CTRL + L
Clear Screen
CTRL + d
Delete current
14 noglob variable
Set noglob to stop the wildcard function, that is, the image symbol *? [] {}~ And so on. All of the special functions they represent will be ineffective. It only represents general characters. The following is an example:
Shell script Learning (1): Shell variables and some common commands
Shell allows you to create variables to store data, but does not support basic data type variables (such as int, float .....), shell interprets any value assigned to a
VC's default font is Ms shell DLG (8), and Ms shell DLG itself is not a font (refer to: http://poxi.bokee.com/957883.html), just a font ing. Take Chinese Windows XP platform as an example, MS shell DLG (8) is (9.5 ). The ing font can be specified
Unix shell programming
Summary of some conditions
-B file: if the file exists and is a special block file, it is true.-C file: if the file exists and is a special character file, it is true.-D file: if the file exists and is a directory, it is true.-
Location parameters in bash shell $ #, $ *, $ @, $0, $1, $2... and special parameters $ ?, Meaning of $-and so on
In bash shellOftenWhen you see some special symbols, I will collect them for reference:
Location parameters:For details, see ABS
Shell script used to detect Processes
10:38:08 | category: centos | font size subscription
Script 1:
#! /Bin/sh
Program = XXXX # process name
Sn = 'ps-Ef | grep $ program | grep-V grep | awk '{print $2} ''# obtain the process port numberIf ["$ {sn}"
If the command "Set-X" is added to the script file, each command executed after the set command and any parameters added to the command line (including the values of variables and variables) will be displayed. A plus sign (+) is added before each
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.