The shell implements statistical views and saves the results to a file

Log files are one per day. A keyword in the statistics log file that gets the number of views per day. Save the number of times to the TXT file.Save the date in the TXT file as well.Enter a start date and an end date to count the number of times per

Shell---Data flow redirection

Data Flow redirection: is a command that should appear on the screen after the data transfer to other places.Standard input (stdin): code 0, using Standard output (STDOUT): Code 1, using > or >>;Standard error Output (STDERR): Code 2, using 2> or 2>>

Shell finds files within a specified time period

#!/bin/bash#20170905 input parameter formatecho "displays" Backup Files "Date_0=$1date_1= ' expr $date _0 + 1 'date_2= ' expr $date _0 + 2 '#定义时间段touch-d $date _0/tmp/tm-0.file #开始时间touch-d $date _1/tmp/tm-1.file #结束时间1touch-d $date _2/tmp/tm-2.file

Shell file permissions and script execution

ll command to view file informationThe first root represents the creator of the file, and the 2nd root represents the group root that the file belongs toRWX delegate Rights R (read) permission, W (write) write permission, x Execute permission,

First shell Script--Modify configuration file

There is demand, can let oneself lazy is the real motive force of study. Because the test environment always needs to manually modify the configuration file after building the code, the learning side completes a shell script that can be modified

Shell Miscellaneous Set

1, Shell Equality comparison note-eq Comparison of numbers equal= = Comparison of string equality2, = = and the difference= = can be used to determine if a variable is equal, = In addition to being used to determine whether a variable is equal, it

The difference between $* and $@ in the shell

$* all positional parameters, being used as a wordNote: "$*" must be referenced by ""[email protected] is synonymous with $*, but each parameter is a separate "" reference string, which means that the parameters are passed completely, are not

Shell parameter processing templates

Save a copy of the template, then use it for simple parameter processing#!/bin/Bash whilegetopts h:ms option #选项后面的冒号表示该选项需要参数 Do Case "$option" inchh)Echo "option:h, Value $OPTARG"#参数存在 the $optargEcho "Next arg index: $OPTIND";; m)Echo "option:

Shell base syntax and monitoring process does not have a restart

transcoding# Dos2unix./test.shPermissions#chmod a+x./test.shGrammarVariableVar= "111"Echo $varEcho ${var}Operationno1=4;no2=5;Let Result=no1+no2echo $result;Self-increment self-reductionLet no++Let no--[] and let similarresult=$[No1 +

A common way for Shell to intercept strings

1, get the character from the front 8, the implementation method is as follows:a=123456789$ expr substr $a 1 8$ echo $a |cut-c 1-8echo $$ echo $a |dd Bs=1 count=8 2>/dev/null2. Interception by the specified string(1) The first method:A string after

View the currently supported shell

/etc/shells more/etc/shells/bin/sh/bin/bash/sbin/nologin/usr/bin/sh/ usr/bin/bash/usr/sbin/nologin/bin/tcsh/bin/cshECHO-E Related escape character\ \ input \\a Output Warning tone\b Backspace, i.e. delete one character to the left\c Remove line

Special variables for the Shell

2017-08-021.$0 gets the name or full path of the current scriptCat Name.shlinux Shellsh Name.shecho $0name.sh2. $n (n >=1) get the script nth parameter note the usage of n>9 ${n}Example: SH name.sh aa bb cc dd EEecho $ $4 $ ${20}Output: AA bb cc dd

Shell exercises (1)

(1) Please follow the date format (XXXX-XX-XX) to generate a daily file, such as the file generated today is 2017-07-05.log, and the use of the disk to write to this file, (do not consider Cron, just write the script can be)!#! /bin/bashd= ' Date

Positional variables and special variables in the shell

$$the PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?end code of the last Run command (return value)$-flag at a glance using the SET command$*all parameter lists. such as "$*" in the Case of "" ", in the

"Shell" gets the first + position parameter

Reprinted from: http://www.cnblogs.com/sheldonxu/archive/2012/06/25/2560770.htmlIn a shell script, you can get the nth parameter in a $n way, for example, a script named Paramtest:#!/bin/bashecho $The result of executing./paramtest a B is to print

Some shell query statements for HBase

Huawei bids (do not want to spit) a variety of reasons can only use HBase shell query, in this record of their own exploration of the hbase shell to avoid the next time you have to findScan ' ogg_sel_ioc_sv_product_name_info ',{filter=>

Shell file Simple processing

Sometimes you need to simply deal with the file, with a few lines of shell script statements can be done, convenient, here to remember, while the next use. Combined with other people's blog and their own practice, but also the original

[Shell] Determine network conditions and add timestamps

A recent need to do a real-time statistical network situation and statistics of the error rate of the script, the following is a stackexchange on the plagiarism, although not fully satisfied, but only can output some information#!/bin/Bashhost=$1if[-

Shell script call jar package print multiplication table

#声明脚本#!/bin/bash#打印 "------CFB---------"echo "------CFB---------"#java环境变量Java_home=/usr/java/jdk1.8.0_11Classpath= $JAVA _home/bin#指定需要执行jar包的位置, you can set your ownJarpath=/home/haha/desktop#环境变量的标准格式Classpath= $CLASSPATH:

Use X-shell on win10 to connect to Ubuntu in a virtual machine

1. In Ubuntu, install SSH:sudo apt-get update # to complete system updatescd/etc/init.d/# See if SSH service is installedsudo apt-get install Openssh-server # for installationsudo etc/init.d/ssh Restart # Restart service, others are:

Total Pages: 541 1 .... 517 518 519 520 521 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.