1, the Linux shell to get the process ID method: ps-a |grep "/usr/sbin/gps_app" | awk ' {if ($ = = ' start ') {print}} 'Pidof "CmdName" Pgrep "CmdName"
The results of these three kinds of operations in bash and BusyBox ash are slightly different,
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
If the file is a. css file or a. js file, it is processed.
File=$1
if ["${file##*.}" x = "css" x]| | ["${file##*.}" x = "JS" x];then
Do something
Fi
Attention:
1> extract file suffix name: ${file##*.}
# #是贪婪操作符, matching from left to right,
Problem description
A few days ago, a friend needs real-time monitoring of a Linux system under a process, when the program is running to continue to monitor, when the program is finished to the end of a word to the end, and do follow-up.
Problem
To sort an integer element in the ArrayList collection in ascending order:
Package org.hyp.test; Import java.util.ArrayList; Import Java.util.Random; public class Mysort {private arraylist list, public arraylist getlist () {return list;} PU Blic
When using the shell under Linux, the array is occasionally used for convenience. The array is declared in the following way:
array= (element1 element2 element3 ... elementn)
That is, wrap the array elements of the parentheses package together,
LINUX SHELL parsing JSON format
1. Use tool JQ
https://stedolan.github.io/jq/
Download version Linux version
Jq-linux64
Ubuntu Direct sudo apt-get install JQ can be. 2. Parse JSON
[Root@cas script]# cat Test.json {"Tasks": [{"id":
I wrote a Java program with the main method entry, already packed a jar and already started running under UNIX, but I wanted to write a script file to make it easier for managers to start and shut down my Java process. Similar to Tomcat
SET Command
The set command acts primarily to display shell variables that already exist in the system, and to set new variable values for shell variables. When you use set to change shell attributes, the function of the symbol "+" and "-" is to
"Lead" on the Android website, the installation part of the JDK has the following requirements: The Master branch of Android in the Android Open source project (AOSP) needs to use Java 8, and OpenJDK is needed in Ubuntu.
For a lower version, refer
Introduce a file in a makefile file by using include
Include $ (shell./getname)
and the contents of the GetName are as follows:
pwd=$ (PWD);
if ["${pwd#*/zloader.}" = "$pwd"];then
Echo Makefile.cpci
Else
echo Makefile.${pwd#*/zloader.}
fi
I've
Ideas:
1, back up yesterday's log, while deleting the five days before the backup data.
2, copy the log file, and set the original log file is empty
Shell
#!/bin/bash
#function: Cut nginx log files
#author Kung
log_path= '/home/wwwlogs/'
Reprint: http://blog.chinaunix.net/uid-27571599-id-3473078.html
Many people have asked me how to write shell script, how to achieve the same time to upload files to three FTP servers, how to detect the three servers are alive and so on, in fact,
#!/bin/bash # # method 1
A=1234;echo "$a" | [-N "' Sed-n '/^[0-9][0-9]*$/p" "] && echo string A is numbers
The first-n is the shell's test flag, and the subsequent string "' Sed-n '/^[0-9][0-9]*$/p '" is tested, and if not NULL,
Rules:
a--number pair, position is right
b--The result of a, the number is correct, but the position is incorrect.
After starting, a systematic initialization of a 4-bit repeatable number, such as "1223". Assuming that the user enters "1234" for the
First, position variables:
$ $ Gets the file name of the current execution script, including the script path.$n gets the nth parameter of the current execution script, 1~9, greater than 9, enclosed in {}, for example: ${10}.$# indicates the number
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