1. Introduction
Use in shell programming to determine parameters within the IF statement–b returns True when file exists and is a block file-C Returns True when file exists and is a character file-D returns True when pathname exists and is a
1. Write at the beginning
Recently in the study Bang Bang shell, in the process of debugging encountered reverse debugging, is very distressed, and every debugging will be interrupted, a friend sent a post "1" introduced one of the Anti-tune, after
Reprinted from Matchless Castle | Demon Angel
When the shell edits the script, the runtime appears "': not a valid identifier", or it will appear (: Command not found, many inexplicable symbols) it is likely that you are editing under Windows,
Specify the script interpreter
#!/bin/bash
Note: 1, the declaration can only be placed in the first line of the script, indicating that the script uses the Bash interpreter to interpret execution, otherwise it will be interpreted as Comment 2,
Brief Introduction
Sed is an online editor that handles a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer, known as pattern spaces, followed by the SED command to handle the contents
Because of the need to use the shell to develop a number of gadgets, when using an array as a function parameter, found that only the first element of the array can be passed, the elements behind the array can not be passed into the function.
The most recent project needs to execute shell commands in Java, in the most common way, with the following code:
public class Shellutil {public
static string Runshell (String shstr) throws Exception {
process process;
Process =
The meaning of the-Z to-D in the conditional judgment in the shell
[-A file] if FILE existence is true.
[-B-file] True if file exists and is a block-specific file.
[-C file] is true if file exists and is a word special file.
[-D file] is true if
Description gives beads with lengths of 1~n, and beads of length I have a[i], each with an infinite number of beads, asking how many options are used to string the beads into a chain of length n input Multiple sets of use cases, each set of use
forwarding https://my.oschina.net/weiqingbin/blog/190929
You can set the following options when you start Impala-shell to modify the command execution environment. Note:
These options are different from the configuration options for the Impalad
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
20.5 logical judgments in shell scriptsYou should use a variable instead when you use a string more frequently in your script and the string length is longWhen using conditional statements, variables are often used?? If [$a-gt 1]; Then ...; FiWhen
In general, we are the most common command for copying data on the same server is CP, which can be used if you want to copy between different servers.Now there are two servers, you need to migrate the files on the a server to B server, because the
It usually takes a long time to run some monitoring tools or disk check tasks in shell.ProgramThe sighup signal is received to terminate the operation. Obviously, this is not the case.The nohup and bash built-in commands disown can solve this
Shell function return value, two common methods:Return,Echo
1) Return StatementThe Return Value of the shell function, which can be the same as that of other languages, returned through the return statement.Example:
#!/bin/sh function test() {
1. Shell uses quotation marks (single quotation marks/double quotation marks) and backslash ("\") for the shell interpreterSHIELD special characters.
Reverse quotation marks [H2] have special significance for shell.
1.1 single quotes and backlash [
The memory of the android program is divided into two parts: Native and Dalvik. Dalvik is the Java heap we usually call. The objects we create are allocated here, bitmap is directly allocated on native. The memory limit is that native + Dalvik
Shell script Learning (2): conditional statements and loop statements 1. conditional statements
First, when it comes to conditional statements, we have to first talk about the judgment of the conditional expressions. What types of conditional
1. Conditional Variable replacement:BASH Shell can replace the conditions of a variable. It can be replaced only when a condition occurs.Put the condition in.(1) $ {value:-word}If the variable is undefined or the value is null, the return value is
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