1. Read reading variables from the keyboard 2. Declare/typeset declaring variable typesA. The-i option of the DECLARE command specifies that the variable is an integer type (the default is a string) B. The-X option of the DECLARE command specifies
When a user logs on to a Linux system, the login shell executes the required script in the following order.First, execute/etc/profile this startup script, in/etc/profile This startup scripts will call all the startup scripts in the/ETC/PROFILE.D
Shell annotations1. Single-line CommentLines that begin with "#" are comments, which are ignored by the interpreter.debian:/# Vim first.sh#!/bin/sh#This is my first shell (this line is a comment)echo "Hello World"2. Multi-line annotationsThere are
Types of variables for bash本地变量(局部变量)环境变量位置变量:$1,$2,$3, ...特殊变量:$?,$#,$*,[email protected]The location variable that gives the script the ability to get external parameters,$1 for the first argument,$2 for the second argument, and so onCases:vartest.
If you have been exposed to the C language, you should know that the C statement is executed when the error editor will indicate the specific error in that line, of course, these errors are the machine can not be executed error! Unfortunately our
One. HIVE StreamingIn hive, when you need to implement a function that is not possible with a function in hive, you can use streaming to implement it. The principle can be understood as: using language other than the HQL statement, such as Python,
In the first line of the executable, we usually specify what interpreter to use to execute the file, such as the shell script, the beginning of the file is usually #! /bin/shRunning the shell will encounter three variables1. Local variables,
Determines whether a variable is empty.1. The variable is caused by "" quotation marksAs shown below:, you can get the result is NULL.#!/bin/shpara1=if [!-n "$para 1"]; Thenecho "is NULL"Elseecho "Not NULL"Fi2. Judging directly by variablesThe
Seq Command IntroductionUse:Seq-print a sequence of numbersGrammar:seq [OPTION] ... Lastseq [OPTION] ... First Lastseq [OPTION] ... First INCREMENT LastCommon options-S,--separator=stringUse STRING to separate numbers (default: \
"Problem" script implementation, you can use Shell, Perl and so on. Save all the rows in file B, but none in file a, to file C and count the number of lines in C.To translate adult words is, suppose that there is a file a is:ABCDFile B is:1234ABNow
1. Count the IP addresses of the top 10 IP trafficCat Access.log | awk ' {print '} ' | Sort | uniq-c | Sort-nr | Head-n 102. View the current day IP traffic statisticsCat Access.log |grep "21/apr/2016" |awk ' {print $} ' |sort|uniq-c|sort-nr3. View
1.shell ScriptNew text, suffix sh, for example: abc.shAttention:The first line in the script needs to write #! /bin/bash#! Specify how to use the interpreter to execute the source code# indicates a commentAttention:PHP can also write shell
Original: https://leetcode.com/problems/valid-phone-numbers/Given A text file file.txt that contains list of phones numbers (one per line), write a one Liner bash script to print All valid phone numbers. Assume that a valid phone number must
TargetImplementation records the start time and end time of the shell execution. Execution state, error message, and so on, the script calls the function in the way that the function encapsulates the log recordSource CodeGeneral function Script
Issue 1: Read the same line of two files simultaneously and insert the rows of two files into the same text# cat aaa1a2a3a4# Cat bbb1b2b3/# vim aa.sh#!/bin/bashwhile read-u3 i && read-u4 j;doecho $i $jdone >cc 3Note that READ-U3 I reads the contents
#!/bin/bash#It ' s written by Caibingsen#Date: 2016-03-15# # Function: Guess the number in the 0-9 range# # Requirements: 1, automatically generate a number each time# # 2, guess wrong five times auto exit# 3, guess the automatic exit# # 4, input
Recently seen in the group sent a calculation, using the shell run without optimization, no algorithmTopic:A basket of eggs:A 1 to take, just to finish.2 2 and 1 left.3 3 Take it, just take it out.4 4 and 1 left.5 5 and 4 left.6 6 and 3 left.7 7
The IF in [] is actually called a quick method of test. Bash's numeric and string comparison operators:
Note = spaces on both sides
String
Numerical
is true, if
x = y
X-eq y
PrincipleDivides the sorted array into sub-sequences (this depends on the originally set step value), then inserts the sequence directly between the individual sub-sequences, and then the increment (that is, the step value) and then inserts the sort,
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