The Backstage execution command, is puts the shell command to the system backstage to execute, does not display in the terminal, does not affect the user to continue to work in the terminal, even if the terminal closes the command also to
ZZ http://www.cnblogs.com/coffee_cn/archive/2010/03/26/1697038.html
Set in Cron, perform every Monday 2 o'clock in the morning (full backup every Monday, incremental backup for the rest of the time) #vi backup.sh
#!/bin/bash
#
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
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":
#!/bin/bash
for_1 () {
echo ' for 1 show item ' for
var in item1 item2 ... itemn do
Echo ${var};
Done
}
for_2 () {
echo ' for 2 show 1~5 ' for
loop in 1 2 3 4 5
do
echo ' The value is: ${loop} '
How to implement the line content code to remove the file * * *:If you only want to see the first 5 lines of the file, you can use the Head command,such as: Head-5/etc/passwdIf you want to view the following 10 lines of the file, you can use the
Unlike Java, PHP and other languages, the process control of SH is not NULL, such as:
public class test{public
static void Main (string[] args) {
int a = ten;
if (a > 5) {
System.out.println ("A is greater than 5");
Redirect Method
When the shell sees
#!/bin/bash
GDB
Help
Quit
Eof
Pipe mode
The combination of the Echo, Sleep command, and pipe operator (|).
#!/bin/bash
(Echo ' root '; sleep 1; Echo ' root ') | passwd
Modify the root user's
Introduction to Shell arrays
Time: 2008-01-23 10:57:33 Source: Linux Federation Collection collation Author:
You can also use array variables in bash, which are assigned two types of values: (1) name = (value1 ...
Shell Programming
1. Briefly
The format for writing shell scripts using the vi text Editor is fixed, as follows:
#!/bin/bash
#comments
The symbol in the first line #! tells the system that the program that is specified by the following path
Overview: In Linux shell programming, there are many conditional expressions for comparison/judgment, and this article makes a brief summary of them.
1. String comparison! Take the anti-n str string STR is NOT NULL
-Z str string str is NULL
STR1 =
Background: Work on a variety of online machine landing scripts, and some need to log into the board before landing on the machine, and some dynamic password, each input is very troublesome, the use of automated landing scripts to manage too
Impala-shell Import and Export
Parameter description:
-q Query (--query=query) executes queries from the command line without entering Impala-shell
-d default_db (--database=default_db) Specify database
-b (--delimited) to format the
#!/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,
h=$ (date +%h) s=$ (date +%s) m=$ (date +%m)
if [$h = = && $m = = && $s = = 10]]
A. bash [] single and double brackets
Basic elements:O
[] Two symbols should be separated by a space aroundO
There is a space between the internal operator and the
List of files and directoriesThe most basic form of the LS command displays files and directories under the Pro directoryThe table of contents and files will display color distinctions.If the terminal is not supported in color, you can add the-F
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