Tag:shell integer arithmetic operator The arithmetic operator shell only supports integer operations, and most common arithmetic operations are used in conjunction with the Shell's built-in command let. +-*/% * * (Power operation) + = = *
First, the file code"Steering" means that the standard input (such as the keyboard) should be read by other files, and the result should be displayed on standard output (such as screen) and output to other files. The concept of file descriptor is
Detailed description View:(a) Play with Me Linux network services: DNS service--bind (/etc/named.conf,/var/named) settings implementation and interpretation1#! /bin/Bash2ip="10.10.10"3rip="10.10.10"4dn="gr.org"5Name="10.10.10.10"6 7Cat
I. Condition judgment of shell programming1. Integer testA. Expressions for conditional tests[Expression][[Expression]]Test expressionB. Integer comparison-EQ: Tests whether two integers are equal, such as $A-eq $B-ne: Test whether the two integers
Subtracts the specified day from the specified date[Email protected] init_env]$ date-d "20150416 3 days" + "%y%m%d%h"2015041912Adds the specified hour to the specified date[Email protected] init_env]$ date-d "20150416 3 hour" +
1. What is bash?Bash is a Unix shell written for the GNU program and is the default shell used by many Linux platforms.The shell is a command interpreter, an insulating layer between the operating system kernel and the user. At the same time, the
"Shell Script Basics"Create a script#vim 1.sh*********************#! /bin/bashecho "Hello world!"*********************#chmod +x 1.sh#sh 1.shHello world!Extensions and command extensions still work within double quotation marks.#echo "Can I have a
1. Convert the date format to a timestampGet current time: Currenttime= 'date'+%y-%m-%d%h:%m:%s' Result: 2015-04-13 11:15:43Convert current time to timestamp: timestamp= 'date'$curtime ' +%s ' Result: 1428894966 2. Convert the timestamp to a date
Problem Description: The direct execution shell script in Linux can find the file with a relative path, but if you execute the shell script through the scheduled task crontab, you cannot find the file by relative path!Example:Shell script file Code ~
1. The script determines whether the command output is empty(1) Determine if the string is emptyIf ["$str" = ""]If [x "$str" = x]If [-Z ' $str '] (-n is not null)Note: You have to double quotation marks, or some commands will be error, form a good
#!/bin/bashwhile ifs=: Read name1 name2 name3 name4#ifs is the split symbol specified when reading from a file, assigning the contents of a to the corresponding variable in separate sections. Do echo $name 1 ' | ' $name 2 ' | ' $name 3 ' | ' $name 4
#read Onefile Line by line forLineinch$(Cattest1.txt); Do Echo$line; Done;# whileReadSplitLine by Space whileRead Line Do forWordinch$line Do Echo$word Done; Donetest1.txt#string Splitor substring input=type=ABCDEFGEcho$input, #get
1. the process of inserting a sort is like the way we usually play poker to get the cards inserted, constantly inserting the cards that have been taken out into place.The initial ordered interval size of the insertion sort process is 1, the first
Use shell for mathematical operations and shell mathematical operations
Availablelet,(()),[]Basic arithmetic operations, advanced operationsbcMore efficient.
Let's look at the code and make the output clear.Let
[Zhengweiwu ~] $ No1 = 4 [zhengweiwu ~
Shell learning-awk getting started
I. awk application scenarios
Format data or extract records from a large text file
Ii. Usage
Command Line$ Awk [-F field-separator] 'commands' input-file (s)Commands is a real awk command[-F domain delimiter] is
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.