File22924 183.136.221.76 20020747 119.146.204.15 20019563 61.182.133.37 20019150 112.85.218.29 20018002 113.106.128.3 200123 113.106.128.3 200
File B113.106.128.31.1.1.161.182.133.37
Ladies and gentlemen, how can we print out all the records of
Simple shell scripts for tasks without variables are generally competent. However, when executing some decision-making tasks, it is necessary to include the IF/then condition judgment. Shell script programming supports such operations, including
The case expression can be used to match a given string, not a number (do not confuse switch... case in C ).
Case... in...) do something here esac
The file command can identify the file type of a given file, for example, file lf.gz. The output
FTP-I-v-n
FTP download, open IP port is the connection server, User Username Password is the login, CD/admin is the CD to the Admin directory under the FTP server, LCD D: /Shell/data is used to change the local working directory to the
Compare shell strings and determine whether the string is a numberBinary comparison operator, which compares variables or numbers. Note the difference between numbers and strings.
◆ Integer comparison
-EQ equals to, for example, if ["$ A"-EQ "$
InShellProgramming.You can use parameters.ShellLocation and Internal Parameters
1
,Location parameters
The parameters provided by the system are called location parameters. The value of the location parameter can be used $ N Get, N Is a
Introduction: for some programs that need to run for a long time (such as server programs), it is necessary to write a monitoring program to enable automatic restart upon unexpected exit. This function can be implemented through a simple shell
ShellColor in
1)
Concept
ANSIEscape code to control the display format
ToCSI(Control sequence indicator).
Select graphicRendition, Select image reproduction
2)
Csin [; k] m
N/KDefine the selected display control,MTableSGREscape
Command line parameters,
Positional Parameter
$0Complete program name(BasenameCommand to remove the path)
$1The first parameter, exceeding9Hour$ {10}
$ #Number of parameters
$ *All parameters in the command line, as a word
$ @All parameters in the
1 If
#!/bin/bashecho "Please chose your favourite fruit:";select fruit in "apple" "orange" "banana" "none";dobreak;done;if [ $fruit == "apple" ] then echo "you like apple!"elif [ $fruit == "orange" ] then echo "you like orange!"elif [ $fruit ==
Awk uses shell variables, and shell obtains the variable values in awk.
09:36:28 | category:Linux | font size subscription
Original article: http://renyongjie668.blog.163.com/blog/static/16005312011829102025222/
I think inLinuxLowerAwkIt is a good
1. Read options
Read can have eight options:-A,-D,-E,-N,-P,-R,-T, and-s.
-: Read the content into the value
echo -n "Input muliple values into an array:"read -a arrayecho "get ${#array[@]} values in array"
-D: Delimiter, that is, the delimiter.
In awk programming, do not forget that awk processes regular expressions. There are many internal functions, especially string processing functions. Calling these functions can reduce the workload.
1. Format
// Note \ There cannot be spaces behind
Under the current path
Ls-altr
Space and sky are both folders, and the rest are files. The directory structure is as follows:
1. List all folders in the current path
Ls-L | grep ^ d
2. count the number of folders in the
Chapter 9: Use the editor
1. Vim Editor
(For more details, see #1, #2, #3)
Start:Vim or Vim File
Two editing modes:Normal Mode and insert mode. Normal Mode is enabled by default.
Move the cursor:
H: 1 character left
J: move down a row
K: Move up a
1. condition test
Two formats: test condition or [condition] (Note that spaces are added on both sides)Condition can be a logical operation of multiple sub-conditions. The logical operator numbers include:
-A logic and
-O logic or
! Logic No
&, |
2.
Shell scripts are used to record some exercise questions and shell scripts I have actually written here for learning and querying.
User input y or y ends
While Mode#! /Bin/bashRead-P "input you choice:" CWhile ["$ C "! = "Y"-a "$ C "! =
The case statementthe case statement is good alternative to multilevel if-then-else-fi statement. It enable you to match several
Values against one variable. Its easier to read and write. Syntax:
case $variable-name in
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.