Linux System-shell Programming-Basic Debug Executiona shell structure1 #! Shell that executes the script2 # Comment Line the annotation of the shell script is important and indispensable3 command and control structuretwo steps to create a shell
Shell Variable BasicsThe shell variable is a very "weak" variable, by default a variable holds a string, and the shell does not care what the string means. So for mathematical operations, you must use some commands such as let, declare, expr, double
Shell Practice 11.requireA B C D1 2 3 45 6 7 83 5 8 01 2 4 3After handling:T A B C DA 1 2 3 4B 5 6 7 8C 3 5 8 0D 1 2 4 31.first need read the first line as an array.Then append the element in the proper position for file;oldifs= $IFSIFS =$ ' \ n ';
# #! There is a space followed by a space followed by the full path of the interpreter and must be correct.#! /bin/ashPro_path= ""# Testpro is an executable program to be guarded, which guarantees it is always runningProgram= "Testpro"# This script
List of special variables
variables
meaning
$
File name of the current script
$n
Arguments passed to the script or function. N is a number that represents the first few parameters. For
1.zookeeperZookeeper can be used to ensure data transaction consistency between the data in the zookeeper cluster2. Start the cluster and checkStart on each machine separately./zkserver.sh StartCheck Status./zkserver.sh Status3. Client starts shell
Online check a lot, no effect, wrote a, although a bit, but the function can still be realized. Talk less, look at the shell.#!/bin/shfunction main {lines= ' Ps-eo user,pid,cmd | grep-v root |grep sshd '; tmp=0;array= (); for i in ${lines[*]}doif [$
A simple requirement: the shell implements the process monitoring watchdog function, with the scheduled task to execute a shell script every minute, monitor the process, if the unexpected interrupt then start him, if normal, do not need to do
There was a bug when I wrote a shell script recently#!/bin/shRight=disk1PART=${RIGHT//[A-ZA-Z]}Tips:Bad substitutionAt the command-line input, it is running correctly.Checked the next someone said to change SH to bash, found the problem solved.
Because spark-1.3 as a milestone release, add a lot of features, so, it is necessary to study a, spark-1.3 need to scala-2.10.x version support, and the system on the default Scala version of 2.9, need to upgrade, You can refer to Ubuntu to install
#!/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[
#!/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 for 8 6) temp=buff= #交换函数swap () {buff=${a[$1]}a[$1]= ${a[$2]}a[$2]= $buff}fun () {i=$ ($1-1)
#/bin/basha= (9 0 345 1 2 1 0) #自己定义一个数组temp =for ((i=0;iThe array that is written above is the array sort that was previously defined in the code, and the following is the sort of array that the user customized during the execution.#/bin/basha= '
#/bin/basha= (9 0 345 1 2 1 0) #自己定义一个数组temp =for ((i=0;iThe above is sorted by a custom fixed array, the following is the user-defined input array to sort.#/bin/basha= ' expr $# + 1 ' #expr是一个计算操作, $ #是参数个数, $#+1 is because there are no storage
Under the shell, what do we need to do to write a shell script and then run it;Win, you can write a AutoHotkey script, and then bind the shortcut keys, one click to run.Many tutorials on the web, such
Fast sorting of shell script programming Sorting Algorithm and shell script Programming Algorithm
#! /Bin/bash # implementation of fast sorting in shell script programming (using the rightmost element as the element) a = (8 5 10 3 2 93 4 1 2 3 40 9
Shell script Sorting Algorithm (Bubble Sorting)
#/Bin/basha = (9 84 51 0 345 1 2 34 1 0) # define an array temp = for (I = 0; I
The array written above is the array sorting defined in the Code beforehand. The following is the array sorting
Linux commands (while, shell parameter usage), linuxshell
#! /Bin/bash while IFS =: read name1 name2 name3 name4 # IFS is the specified delimiter when reading content from a file: the separate parts are assigned to corresponding variables
Linux shell and shell
-------------------------------------- shell application tips ------------------------------------ command completion: tab key completion shell command 2: clear or ctrl + l clear screen ctrl + u clear all the content before
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