Today, when deployed in Jenkins, because developers frequently submitted code, resulting in Jenkins shell script in that frequent deployment, in order to prevent such problems, a special search to prevent the recurrence of code. Here's a look at the
Script A (test example 1)
The code is as follows
Copy Code
#!/bin/bashEcho ' Your are in the '
Q) Call another script file in the current script file?
Method One: Using source
Script second (test example 2)
Using the Linux shell is my daily basic work, but I often forget some useful shell commands and L tips. Of course, I can remember the order, but I'm not sure I can remember how to use it to perform a particular task. So I began to record these
Example The difference between-E and-F is that-F stands for regular files (regular file), and-E represents all types of filesRefer to the following:-e filename true if filename exists-F filename True if filename is a regular file-L filename True
When using Jenkins for integrated deployment, when we deploy the generated war packages, we often need to make some backups or suspend the operation of the server, which can be executed directly in Jenkins.1, first install the plug-in SSH Plugin 2
1 single quotation marksSingle quotation marks can be used to restore the literal meaning of characters, to implement the function of shielding metacharacters, single quotes must be used in pairs[Email protected]~]# echo ' $JAVA _home 'Special
(1) Replace one or more spaces in the text with commasThe text reads as follows:# Cat Text1 2 2 3 3 + 4 4 2 4(2) The Shell program code is:# Cat Text | Sed ' s/[' []*/,/g ' 1,2,42,2,3,43,3,44,4,,4,,2,4Script Description:
sRepresents the
Position variable.$ $ Gets the file name of the currently executing shell script.[Email protected] ~]# vim 0.sh[email protected] ~]# cat 0.shEcho[[Email protected] ~]# sh 0.sh0.sh[Email protected] ~]#
If I put it in the full path, it will.
The shell command can be executed directly in awk.[Plain]View PlainCopy
[Email protected]:~$ Touch A
[Email protected]:~$ Touch b
[Email protected]:~$ cat A.txt
A
B
[Email protected]:~$ awk ' {cmd= ' rm ' $0;system (CMD)} ' A.txt
Process Control is the instruction that alters the order of the program's operation.4.1 If statement4.1.1 Single Branchan If condition expression; Then command fiExample:#!/bin/bashn=10if [$N-gt 5]; then echo yesfi# bash Test.shyes4.1.2 Dual
In the production environment log is the operation and maintenance personnel to understand and analyze the production environment first-hand information, but the content of the log information is quite large, especially in the public cloud
Technorati tag: Shell,df,sed,awk -Monitor System statistics
Monitor disk free space
Disk Resource Usage
Monitor CPU and Memory usage
-Perform a backup
Archive data files
Offline Storage of Backup files
Getting started with Linux shell scripts--cut commandCutThe Cut command extracts text columns from a text file or text stream.Cut grammar[[email protected] ~]# Cut- D " Delimited character " -F fields for having a specific delimiter character [[
Shell common system Variable resolution: $ $ The name of the current script $n the nth parameter of the current script, n=1,2,... 9$* all parameters of the current script (excluding the program itself) $# the number of arguments to the current
#!/bin/bash#2.sh# Write a shell script to get the network address of this machine. #比如: The IP address of this machine is: 192.168.100.2/255.255.255.0, then its network address is 192.168.100.1/255.255.255.0# Note: Bcast with the previous IP address
Today in the shell script to write Fibonacci sequence calculation, has been constantly error, the main reason is because the shell script is too intelligent, in the array operation need to write a lot of symbols, it is easy to confuse, so a little
Replacing File content in Centos in batchesThese two Angels used the locomotive to collect some data because they generated a lot of SQL files. I want to replace the fixed content in each SQL file with another content.Manual file configuration
After using thin or rbenv, many friends found that rails could not be started happily with linux startup.Remember the following points:1. Make the PATH contain the rbenv PATH2. Check the/var/logs/boot. log file during debugging.The specific process
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