Shell Common ScriptsAuthor:headsen Chen 2017-10-17 15:36:17Personal original, reproduced please indicate, otherwise, legal liability shall be investigated1,vim name.grep.sh2,cat tellme.sh3,cat idcheck.sh4,cat case.shNote: The file name is called in
To test the shell's looping nesting syntax1[Email protected] test]#VIXunhuanqiantao.SH 2#!/bin/Bash3 #程序功能描述:4 # test Loop nesting5 #作者: Lone boat Point6#版本:1.07#创建时间: .-Ten- A Geneva: $:
(title): Determine if the incoming parameter is IPIdea: 192.168.1.1is the condition of the IP, * * * dot decimal This four number must be less than 255Dot decimal must be guaranteed to be a number, not a letter#!/bin/bash[ -z $1 ] && echo "uesage :
1/etc/profile2 ~/.bash_profile3 ~/.BASHRC4 $PATHWhere/etc/profile is the global environment variable that takes effect for all users, while. Bash_profile only works on the current user.~/.bash_profile: Each user can use this file to enter shell
Linux often need to delete user actions, manual operation to perform Userdel operation can, if the deletion fails according to the error prompt action. But what if the script needs to invoke the Delete user action? Use the following example to
Steps to create a shell program:First step: Create a script file. Sh.Second step: Grant permissions so that it can execute chmod u+x. shStep three: Execute./example or SH exampleShell structure:1. #! Specifies the shell that executes the script2.
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
Tag: will return CTR Word delete Move page ackMove cursor
ctrl+b: Move forward one character (backward)
ctrl+f: Move back one character (forward)
alt+b: Move forward one word
alt+f: Move back one word
ctrl+a: Move to the
MY.CNF configuration format is as followsVI my.cnf[Client]port=3306Socket=/tmp/mysql.socket[Mysqld]port=3306Server-id=1Datadir=/usr/local/mysql/data[Mysqld_safe]port=3306More parsemy.sh#!/bin/bashcnf=$ (CD ' DirName;p wd) "/MY.CNF"#得到区块数组g_sec= ('
Shell script is a "program" written using the shell's function, which uses plain text files to write some shell syntax and instructions (including external instructions), with regular expressions, pipeline commands, and data flow redirection. In
Delete the first line in the file file1 to the line containing word characters and redirect to the file File2:Sed ' 1,/word/d ' file1 > File2Keep the lines in the file file1 that contain word characters and redirect to the file File2,-n to indicate
Requirement: One file displays the content three line as a lineIdea: is the second line of content, the contents of the third row is appended to the first row, so that the contents of three lines can become a row, if not enough three lines
The origin of 3. shell basic knowledge 3.1 shell 3.1.1 bourne agin shell 3.1.2 the other shells, have zsh, ksh 3.2 see if shell 3.2.1 yum list | grep zsh 3.2.2 ls /root/.bash_history 3.2.3 echo $
Scripting features: Display all disks and select, partition all selected disks, repartition partitions and format file system#!/bin/bash# Display all disks and select, format partition of selected disk, repartition partition and format file
To find files that end in INI[[email protected] app]# Find/-name "*.ini"/app/myblog/config.iniEXEC explained:The-exec parameter is followed by command, which terminates with '; ' To end the sign, so the semicolon behind this command is indispensable,
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
There are several places in the recent new project where you need to invoke the shell script, which records a simple shell script invocation method. The code is as follows:private void Callsh () {InputStreamReader STDISR = null;InputStreamReader
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