1. If you judge some special usageIf [-Z $a] This indicates what happens when the value of variable A is emptyif [!-e file]; Then what happens when the file doesn't exist?if (($a ,==,!=,>=,$ $ does not exist, so n is empty;[Email protected] ~]# n= '
#!/bin/bash### #定义screen的名字, the following installation will use screen this command screen_name= "LANMP" #根据 $UID to determine whether the user is root, must root to perform if [ $UID != 0 ]; then echo "You must be root to
First look at the help command for hive:[[email protected] hive]$ hive-hmissing argument for option:husage:hive-d,--define Va Riable subsitution to the Apply to hive commands. e.g.-D a=b or--define a=b--database Specify the database to Use-e SQL
1.history Save History Command 1000, history-c empty;2.! String calls the most recently used command,! Vim's most recently used vim,! N calls the last Ming ' l,!242 that begins with N to invoke the No. 242 command in history.3.alias Rename, alias h5=
A related knowledge 1) By default, the standard input is the keyboard, but it can also come from a file or pipe (pipe |). 2) By default, the standard output is terminal (terminal), but can also be redirected to a file, pipe, or post quotation mark
The program must start with the following line (must be in the first line of the file):
#!/bin/shThe symbol #! is used to tell the system that the parameter behind it is the program used to execute the file. In this example we use/BIN/SH to
1. When defining variables, You cannot leave spaces on either side of the = sign.egGender=femal------------RightGender =femal-----------Wronggender= femal-----------Wrong2. Conditional test statement [the symbol is left blank on both sides .]egif
If you want to add a character after a variable, you can use the following method: $value 1=home$value2=${value1}"="Echo$value 2 Add the string variable you want to add {}, and you need to put the $ out. The result of this output is: Home=, which
Shell Script (ii)#find查找文件 to find based on time, name, UID, GID, permissions, size, etc.A file or directory accessed within #-amin-10:10 minutes; a file or directory accessed +10:10 minutes ago. The time unit is minutes.#查找10分钟之前30分钟之内访问过的文件或目录Find/
The shell, known as a program that acts as an interface between the user and the Linux OS, allows the user to enter commands that need to be executed to the OS. There are a lot of shells here, just bash. 0) Shell version of the experimentShow Shell
In the shell, especially in the shell loop, some expressions may be used to operateThis requirement can be accomplished using the expr command, such as:x=$ (expr $a + 1)Completed the calculation of the sum of $ A and 1 and assigned the value to
Linux Shell Program DebuggingThe shell program is debugged by adding relevant debugging options when running the program or by adding related statements to the script, allowing the shell program to display some "debug information" for reference
Today learn bird's private dishes, according to the book hit a few shell script, but the total errorThe first is to use [] to determine the condition, = = does not work properlyThe second is to declare variables in the script to use declare, always
Http://c.biancheng.net/cpp/view/6998.htmlOpen a text editor, create a new file, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write a shell script in PHP, the extension is
for a list of the current path under the directory (not the list of directories) method, and share with you ~ ~1. Using ls-d with wildcard charactersls-d * * 2, ls-f with grep query with/end of the content-F: Displays the directory behind the/ls-f |
How shell scripts run$sh script.sh$sh/home/path/script.sh$chmod a+x script.sh; $./script.shEcho's three ways to use echo Hello World Cannot contain some special keywords, such as semicolons;echo "Hello word" Cannot contain some special characters,
Defining arraysArr= (1 2 3 4 5)accessing arrays# echo ${arr[0]}1Print all the values in an array# echo ${arr[*]}1 2 3) 4 5Print array length# echo ${#arr [*]}5The above defined array, the index can only be a number, the following will describe the
SHELL script-1, shell-1
.: Represents any character
*: Matches the preceding character. a * Indicates zero or multiple.
+: Match with the previous character to indicate one or more previous characters.
? : Matches with the previous character to
Centos shell command line only show-bash-4.1 # do not show the user and path solution,Zookeeper accidentally called the home Directory deletion command today. Although it was not deleted for various reasons, many files and directories in the home
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