[Root@centos65 liumengyang]# cat test.sh
#!/bin/sh
#if The process Exists,kill it
pid=$ (Ps-ef|grep java| awk ' {print $} ')
pidname=$ (ps-ef|grep java|grep-v ' grep ' |awk ' {print} ')
#judge If the process is Running.if Not,restart.
If
http://www.51testing.com/?uid-45739-action-viewspace-itemid-185211
JoinSimilar to the Join method in db, there is also a left join right join INNER JOIN, etc.Specifies the way the join is specified by the parameter-A.-A1 represents a row that
Here are two ways to use the shell's regular expressions. use method One:
#赋值给变量var
read var
#定义regex正则表达式
regex= "[0-9]"
if [$var =~ $regex]];then
#match
#do Something
fi
For example, to match the input, the requirement must be a number
1, shell overview
Each person after successfully logged on to Linux, the system will appear a different hint symbol. For example, $, ~, #等, and then you can start typing the command you want, and if the command is correct, the system will execute
Recently started to learn bash shell, I do not know where to start, do not know what a good tool package to learn it. First Look for:
yao@wuyao:~$ Apt-cache Search BashApparix-console-based Bookmark Tool for fast file system navigationBackup-manager-
If there is a possibility of a "^m" symbol in the end of a shell script that uses Windows editing
Because MS-DOS and windows are carriage return + line wrapping, so in Linux with Vim to see the code written in Windows VC, after the end of the "^m"
Today continue the last Find command content, mainly find and-exec and xargs combination and use.
(9) The Find command can be combined with other commands with the help of an option-exec. -exec is one of the most powerful features of find.
For
This article writes that Java invokes the Linux shell command and returns the result as a stream.
The following is directly on the code, the code is annotated.
Very plain and easy to understand.
Import Java.io.BufferedReader;
Import java.io.
1. Read command
The read command reads information through a keyboard or a line of text in a file and assigns a value to a variable.
1.1, read reading the keyboard data, the input of the content before the return of the data assigned to a variable:
We renamed yesterday's log 00:00:01 every day, placed it in a specific directory, and then USR1 the information number control Nginx to regenerate a new log file
Create a new shell script under directory/usr/local/nginx/logs/runlog.shNote: The file
First, Introduction
1.
Cal Calendar
LS Viewing files and directories
WHOAMI Viewing Current user information
Users or who or W view the current online user
Logout Sign Out
Shutdown or Powoff shut down the system
Init 6 or Reroot reboot system
passwd
Recently looking at the script inside the OpenWrt, with too handsome, the following 2 parameters extended expression of large use, all recorded.
${parameter:+expression}
If parameter has a value and is not empty, use the value of
Everyone must know how to get the sed into the shell variable
However, there is a problem with passing in the path variable.
#!/bin/bash
export vob=/home/fesu/server
sed-n '/^vob/{s/\ (vob=\). */\1 ' "$VOB" '/P} ' $VOB/scripts/build/ Makefile
Checkpid: Check if PID already exists, if one exists, return 0 (by viewing the/proc directory)Daemon: Start ServiceKillproc: Kill a processPidfileofproc: Finding the PID of a processPidofproc: Ditto, use the PIDOF commandStatus: Returns the state of
The previous writing test program used scripts to raise interest, combined with specific cases, to test the results of learning. Finally understand a slightly more complex shell script. There are still a lot of technical things in there.
Declared
In the Linux shell, often input commands have a lot of similarities, even the same, if the long command, the efficiency is really very low, but can be through ctl+r, find the history of the previous input commands, it is very useful.After pressing
PM2:Start ----- pm2 Start/bin/www-watch stop ----- pm2 Stop app_name| app_id Display LogView port occupancy and force the release of occupied portsSometimes when the software is turned off, the background process dies, causing the port to be
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