In development, we often need to change the N-file encoding, ICONV can only make changes to a single file, how to do? Let's write a shell script to solve this problem.
Example one: Using shell script to implement bulk transcoding operation.
#!/
There are 3 main types of shell loops, for,while,untilThe Shell's branch judgment is mainly 2 kinds, if,case
A, for loop
Copy Code code as follows:
#!/bin/bash
For file in $ (ls/tmp/test/mytest |grep SH) The//for in format is
I. Single-select annotations
Lines that begin with "#" are comments that are ignored by the interpreter.
Copy Code code as follows:
#--------------------------------------------
# This is a script that automatically plays IPA,
This article describes the Gearman::xs in CentOS under the compiler installation method, for everyone to learn about!
At present Gearman can support a variety of languages, its official website description is as follows:
Language
Each process will have a PID, and each PID will have a corresponding directory under the/proc directory, which is the implementation of Linux (current kernel 2.6) system.General backdoor procedures, in the PS and other processes to see the tool can
1. Take the length
Copy Code code as follows:
Str= "ABCD"
Expr Length $str # 4
echo ${#str} # 4
Expr "$str": ". *" # 4
It seems that the second type is commonly used
2. Find the position of substring
Copy Code code as
Renames the current directory's image file in a specific format, as follows:
Copy Code code as follows:
#!/bin/bash
#Filename: rename_photo.sh
Set-x
Count=1
For IMG in *.jpg *.png
Todo
new=image-$count. ${img##*.}
MV
Rman backup Script
#!/bin/bash
su-oracle
Third backup save platform automatically cleans up expired backup files
#! /bin/bash for
file in ' Ls/orabak '
does
if [[${file:0:2} = = ' db ']];then
If your directory level is very deep, this shell will be very convenient to switch directly to the destination directory, such as
Current directory/usr/home, and directory Desdir in/usr/home/app/local/opp/william/desdir
Direct penetration
$ CD
We can pass parameters to the script when we execute the Shell script. The format for getting parameters within a script is: $n. (n represents a number, 0 is the name of the shell script executed, 1 is the first argument to execute the script, 2 is
Command historySummary: Bash holds a list of commands that have been executed in the past.The command process for the current shell is saved in memory.When you exit, save the hidden folder to the current User folder. Bash_histroy, ls-a can
The color of the text terminal can be generated by using the ANSI unconventional character sequence. Example:
echo -e "\033[44;37;5m ME \033[0m COOL"
The above command sets the function as follows:
The shell automatically collects server hardware system information, inserts a database, and displays it through a Web page.First, the shell automatically collects server hardware system information and inserts the database. #centos under 7
1. Analog Linnux Login Shell#/bin/bashEcho-n "Login:"Read nameEcho-n "Password:"Read passwdif [$name = "CHT"-a $passwd = "abc"];thenecho "The host and password is right!"else echo "Input is error!"Fi2. Compare two number sizes#/bin/bashecho "Please
HBASE table Structure Management detailed explanation List List of tables1 hbase (main):001:0> list 1 table 2 cdr 3 noc 4 2 row (s) in 0.1800 seconds 5 Span
Shell commands are generally divided into built-in (self-contained) and exotic (except those that come with the Yum installation later)How to produce a built-in command: $ man Bash 1 (why add a 1 here because of the manual format)The composition of
Create accounts in bulk: Prompts the user to enter the first user name (such as People1) and the last user name (such as People10)[Email protected] ~]# vim useradd2.sh#!/bin/bashRead-p "Please input first User:" FirstuserRead-p "Please input last
CentOS 61-Key System optimized Shell scriptThe contents of the script are as follows:#!/bin/bash#author Suzezhi#this script is only for CentOS 6#check the OSPlatform= ' Uname-i 'if [$platform! = "x86_64"];thenecho "This script was only for 64bit
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