Shift operations in the shell

Positional parameters can be shift shifted left with the command. For example, the shift 3 original $4 now become $1 , the original $5 now become and $2 so on, the original $1 , $2 $3 Discard, $0 do not move. Commands with no parameters are shift

The use of SEQ in the shell

The use of SEQ in the shellExample:/bugzilla/group.00....group.99 more than 3 years of data mv to/history/bugzilla/group.00...group.99Seq-w (-w = 0 in front to make the same width)#!/bin/bashFor Inum in ' seq-w 00 99 'DoSsdir=/bugzilla/group.

Shell's Tomcat log backup

#!/bin/bashbackdir=/backup/logs/' Date +%f ' catdir=/home/tomcat/apache-tomcat/logsbackfile= ' find $CATDIR-type F- Mtime +3|grep-v catalina.out ' ceshi= ' echo $BACKFILE |wc-l ' Logfile=/home/lichuang/backup.logbackup () {if [$CESHI-le 1]t hen echo

Shell script-Read configuration file

Demand Sometimes in the shell script needs some execution, if placed in the program is not easy to unified management, and every time you modify the path to the script inside to change the trouble, so the unified path in the configuration file

2. Shell's shell configuration file

1. Location of shell configuration files The most commonly used shells are SH and bash, which only speak sh and bash here. 1.1. SH (Bourne Shell) configuration file has two main, respectively, each user home directory

Shell monitoring Tomcat (three) port is normal

#!/bin/bash#by lc#protnum= ' netstat-lntup|grep java |wc-l ' [email Protected]tomcat_prot () {if [' Netstat-lntup|grep Java |wc-l '-ne 9]then clear Echo-e "\033[31m############################################\033[0m" Echo-e "\033 [31m#\033[0m "" \033

Shell backup + to determine if the transfer is complete

#!/bin/bash#by lc#dir=/rootdir=/server/scriptsyuanfile=hins423437.tar.gzbakfile=hins423437_xtra_20.*. tar.gzlc  () {  if [  ' ls -l  $DIR |grep  "${bakfile}" |wc -l '  -eq  1 ]  then     duyuan= ' ls -l  $DIR |grep  "${YUANFILE } "|awk  ' {print $5}

The ANSI control of the bash shell

Format: echo-e "\033[word background color; font Color m string \033[0m"For example:Echo-e "\033[41;36m something here \033[0m"Where 41 of the position represents the background, 36 of the position is the color of the wordThose ASCII code is the

Lao Li share: "Linux shell Script Raiders" essentials (eight)

1. Printing process [[email protected] program_test]# PS-E | HeadPID TTY Time CMD1? 00:00:03 Init2? 00:00:00 Kthreadd5 y 00:00:00 migration/06} 00:00:00 ksoftirqd/03 y 00:00:00 migration/04} 00:00:00 watchdog/07? 00:00:00 events/08? 00:00:00 Cgroup9?

Shell Common Small commands

1. Renaming1) Simpler processing command: MV original filename new file namesuch as: MV MyFile newName # # # will myFile renamed to NewName.2) Renaming files command: Rename name_old name_new fileFor example: Rename MyFile newName myfile.text # # # #

Linux Shell Script Raiders 001

Shell scripts are usually text files that start with #!/bin/bash. #! is placed before the interpreter path.Use bash as the interpreter to interpret all command-line commands.There are two ways to run a script, one is to use the script as a

Note-shell Special variables

Positional variables:$: Gets the file name of the current execution shell, including the script path if the script is executed with a path $n: Gets the n=1..9 parameter value of the currently executing shell script, which represents the file

Getting Started with Shell programming

1.5 Cut command--split fileCut-d:-F 3/ETC/PASSWD take 3rd paragraph1.6 Sort Command--sortSORT-T:-k3/etc/passwd sorted by 3rd paragraph-N Sort by number-R Reverse Order-U Remove Duplicate entries1.7 WC Command-L Calculation of rows-W Computed

Shell reads text content

In Linux there are many ways to read a file row by line, the most common is the method in the following script, and is the most efficient, most used method. In order to give you an intuitive feeling, we will test the execution efficiency of various

Using Shell to bulk add users

Add users in bulk and set a random password to save the added user's name and password to a file.[Email protected] scripts]#CatUser.SH #!/bin/SH forIinch`seq-W Ten` DoPass=$(Echo "' Date ' $RANDOM"|md5sum|Cut-C1-8) //Take the random number method is

Summary of Linux endpoints and Shell

Early computers because you understand the reason there are multiple physical terminals (by connecting the port of the computer what to achieve), here the terminal is the I/O device. The computer itself, which is inherently an I/O device (not an

Shell script copies folder contents to another folder, and automatically backs up if it exists

Sometimes we need to overwrite a folder to our working directory, but need to automatically back up the existing files, one to go back to the backup is too troublesome, all the backup is not necessary. Shell scripts can do a good job of doing this.

Font discoloration in the shell

Use digital code to color your fonts in Linux Font color code: Reset 0 , black, red, green, yellow, blue, magenta , Cyan, light grey Panax Notoginseng Effect code:1m bold 2m plus underline 5m flashing effect 7m plus background color

Lao Li share: "Linux shell Script Raiders" Essentials (i)

Chapter One: Shell Start-up basics1. Variables: In bash, the value of each variable is a string. Whenever you assign a value to a variable, there is no quotation mark, and the value is stored as a string.2, Var=value; Assignment operationvar = value;

Shell strings and Arrays

String:1. Single quotes:str = ' value 'Single-Quote String restrictions:Any character in a single quotation mark is output as is, and the variable in the single-quote string is not valid;Single quotation marks cannot appear in single quote strings

Total Pages: 541 1 .... 418 419 420 421 422 .... 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.