---restore content starts---The calculation of the shell is actually already in contact with Linux. Every time in the use of the Internet is looking everywhere, so think to spend some time to study.First understand the following commonly used
Some of the simple scripts that you've knocked over and put them on the occasional look, it won't be long before you feel very pediatric, but it should be helpful to understand the process control of shell scripts.#!/bin/bashp=176.202.52.For I in $ (
The shell script shell is a non-type interpreted language, which is defined when assigning a value to a variable.#!/bin/bash //环境说明- chmod o+x 文件名 //命令行运行
/bin/bash file name//Ibid. function
$ variable name//reference variable
$//The name
First shell script# VI test.shAdd the following:#!/bin/bashecho "Hello World"#! is a contract tag that tells the system script what interpreter to execute, which Shell to use.The echo command is used to output text to a window.There are two ways to
Shell Command Application Exercise(1) The use of the following documents is briefly reviewed through the Help information/ETC/PASSWD records the user's account/etc/shadow is an optional encrypted password file (view requires sudo
One, pipe and operation controlPipe character |: To pass the output of a file to the following commandgrep: A command used to filter a specified keywordApplication Examples:[[email protected] ~]# ls |wc-l//list How many rows are in the current
First, Shell introductionIi. History of the OrderHistorical command Store path/root/.bash_history, default can hold 1000 commands#history//View specific history commands[[email protected] ~]# echo $HISTSIZE//system built-in environment
There are some differences between the interactive shell and shell scripts of Linux, mainly because of the existence of a separate running process, so there is a difference between the acquisition process PID.Interactive Bash Shell get process
Requirements: Remove the IP field from the log and sort the statistics. General use awk command if the IP address is the first field thenawk ' {print '} ' filename |sort |uniq-c|sort-nrWhat if it's not the first field and there are several
Variable
Variables are abstract concepts that can store calculated results or can represent values. Variables can be accessed by variable names.
Variable declarationDeclaring variables is generally used in the following
1, write script/root/bin/systeminfo.sh, display the current host system information, including hostname, IPV4 address, operating system version, kernel version, CPU model, memory size, hard disk size#!/bin/bashecho "hostname: `hostname`"echo "ipv4
Purpose and Requirements:When porting, you need to integrate the new content in the root filesystem rootfs1 into the ROOTFS2, but not the things rootfs2. That is, you can only compare the similarities and differences of two file systems, moving more
Compare days with 2 dates1. Script referenceScript 1:
#!/bin/bash#格式化过期日期,格式化过期日期完整时间以当前时间作为参考!expday="2018-04-11 `date +%T`"echo "Expire day is $expday"#当前日期时间格式为stamp时间戳todays=`date +%s`echo "Today is $(date +"%F %T")"#以下2种方式做时间的四则运算,分别使用
Recently a new deployment of the gateway, the user in the implementation of the HBase Shell mode connection HBase, error[[email protected] lib]$ hbase shellslf4j: class path contains Multiple slf4j bindings.
First, Shell introduction
The
Shell is a command interpreter that provides interaction between the user and the machine
supports specific syntax, such as logical judgment, looping
each user can have their own specific shell
When using Server-side git Hooks a while ago, you need to get git-submitted information, and here's a simple summary of how to get the parameters that git passes.Git 传递参数 标准输入流 passes the submitted information in or out of the form.Get parameter
Signal list:Common commands related to Linux and signaling are the kill and trap commands, down how to use traps to control the springboard script using the command:Command: Kill-l and Trap-lImportant signal and explanation of Linux system in
First, in Eclipse, the Java program is made into a runnable jar package1. Simply package the SRC directory and the third-party jar in the Lib directory 2. After selecting these two positions, "next", then "Finish", generate the Jar package3. Build
Functions in the shell1. First case:[[email protected] shell]# sh fun1.sh the first par is bthe second par is athe third par is 2the script name is fun1.shthe number of par is 5[[email protected] shell]# cat fun1.sh #!/bin/bashfunction inp(){
Shell script sum (Code instance), shell script sum instance
The principle is as follows:
1) define two variables I, sum, both initialized to 0 2) define a loop body, calculate the sum. 3) Use let $ sum = $ sum + $ I to replace the value. 3) sum of
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