if [str1 = str2] When two strings have the same content, the length is true
If [str1!= str2] True when string str1 and str2 are unequal
If [-N str1] is true when the length of the string is greater than 0 (string non-empty)
If [-Z str1] is true when
Phenomenon: Prompt source:not found when source aaa.sh in shell script
Reason: Ls-l ' which sh ' hint/bin/sh-> dash
This means that the dash is used to parse.
Change Back method:
Command line execution: sudo dpkg-reconfigure dash
Select No
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,
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.
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
#
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:
Creating a table Create ' test1 ', ' lf ', ' SF ' Lf:column family of LONG values (binary value)--Sf:column family of STRING values imports According to put ' test1 ', ' user1|ts1 ', ' sf:c1 ', ' sku1 ' put ' test1 ', ' user1|ts2 ', ' sf:c1 ', '
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,
#!/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} '
"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
to write a shell program in Linux and perform the steps
Brief Introduction
I am the first time to write a blog, do not know what should be the format and precautions, please advise.
Today is about how to create a script and run it in a Linux
Execute the same command on multiple machines on a cluster because of actual development needs. For example, execute a specified script, delete files in the same directory (this is prudent ~ ~) and so on, the members of the group developed a ALLSCP (
This paper mainly introduces the 4 methods of the shell reading files by line: While loop method, redirect method, pipeline method, file descriptor method.
method 1:while The most efficient and commonly used method in the loop.
The code is as
Using variables from the shell in awk
One: "' $var '"
In this way, you don't have to change the habit of using the AWK program, which is commonly used by foreigners. Such as:
var= "Test"
awk ' begin{print ' $var ' "} '
This notation is actually a
Options for UNIX types: UNIX has the advantage that standard UNIX commands have the same command-line format at execution time: command-options parameters if the shell is executed in the same format, the Bourne shell provides a A statement that
File command to view the properties of *.sh ASCII text with the CRLF line terminators
The line end flags for Linux and Windows text files are different. In Linux, the text file uses "/n" for carriage return, while Windows uses "/r/n" to indicate
#!/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
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.