ShellThe shell is a weakly typed programming language.Distinction between strong and weak:Strong: Variables must be declared prior to use, and even require initialWeak: Variables are declared when they are used, even the part is differentiated by
1, consider the following requirements, in the main shell execution command, enter the other command, the input after, want to as the input of the command, instead of the main shell input, how to do?2, use 3. The EOF here is just a delimiter and can
1.4adding environment variables using functions1.4.1Introductionenvironment variables are typically used to store path lists, which are used to search for executables, library files, and so on. For example:$PATH,$ld_library_path, and they usually
The first step:SSH Password-free login "with public key, private key"Step Two:#!/bin/bash while read server; Do "[email protected]" 2 >& 1 "s/^/$ Server:/" &donewait./bunsan2.sh Free Note: While read server considers the input as a
1. CommentsIf you use bash, then in the script file header comment: #/bin/bash2, the script file with the Read and execute permissions, you can use the./shell.sh to execute, you can also use the SH shell.sh way to execute directly, SH is the soft
1. View versionCat/etc/debian_version7.82, look at the memory (my side is 256MB memory swap divided by 4G)Free-mTotal used free shared buffers CachedMEM:231 124 106 0 8 79-/+ buffers/cache:36 194swap:3814 0 38143. Using stress to simulate the
#/bin/Bashhint () {Read-P"Press Enter Tocontiune:"}check_a () {PS-ef |grepCxiang|awk '{for (i=1;i'Text1//use grep and awk to filter the process into Text1. sed '/^.*/s///g'Text1 >text3//delete Text1 in front of empty row in Text3grep-VWF Text3 Text2/
$MYSTR ="node=slave-01:2.05:1.25:1.00"$ time tmp=${mystr%%:*}; echo ${tmp##*=}real 0m0.000suser 0m0.000ssys 0m0.000sslave-${string#*pattern} minimizes matching pattern from the left and deletes (starting from the left) the first pattern
Combat 1: Enter 2 integers to determine the sizeThree ways to achieve:1 defining a variable 2 script parameter 3 read read-inThe first step, give the user prompt, let it enter an integerThe second step is to determine that the first value and the
1. Practice Yourself#!/bin/basha=0while:d o a= ' expr $a + 1 ' if [$a-lt 4]then echo-n-E "input number 1 to 9 \ n" read Num case $Num in 1|2|3|4|5|6 |7|8| 9) Echo-e "You are number is: $Num!" ;; *) echo "R error number, game over!" break;;
Shell Programming:Bash Variable type:Environment variablesLocal variables (local variables) Positional variables Special variables (built-in)Local variables:Varname=value: Scopes are available for the entire bash process;
A. Character test= =: Test for equality, equality is true, not equal to False! =: Test Whether it is unequal, not equal to true, etc as false>-N String: Tests whether the specified string is empty, empty is true, or false-Z String: Tests whether the
The feature of this series of blogs is--give the results of each orderOriginally wanted to write a good process, get a picture of what, but think online analysis too much, are better, so these blog even if it is a summary of their own it.#include
#!/bin/bash#shell implementation of the fast sequencing of script programming (with the idea of a meta-point at the far right) a= (8 5 3 2 for 4 1 2 3-9, 8 6) #a = (0 0 0 0 1 2 3 3 4 4 8 30495 921 43716) temp=buff= #交换函数swap () {buff=${a[
Linux learning-advanced shell script programming (I) Functions and shell script Programming
Citation:When writing shell scripts, you will find that the same code or functions are used in many places. It doesn't matter if it's a small piece of code.
Shell disrupt file lines
The idea is to generate a random array, and then output the row in the file according to the array elements. 1. It is very easy to generate a random array. It was a little difficult to start using it for the first time. 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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service