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
In the case of Red Hat Enterprise Linux versions, the contents of Rhel are as follows,/bin to store commands used by ordinary users/sbin storing commands that administrators can executeHome directory for ordinary users such as Zhangshan home
Linux file system is the hard disk space format into a number of node and block data blocks, the creation of general files, directory creation, will occupy a node, if the creation of a file, the specific data stored in a number of block data block,
Shell scripting is like a language, involving the environment, basic syntax, variable definitions, functions, parameters (System parameters), condition determination, execution Process control, and so on.This article describes the following aspects:
If we need to restrict a Linux user to use only the commands we specify, we can use the restricted shell.Use in a normal command environment:Test: # bash-r # Enter the restricted shell# cd/bash:cd:restricted# exitSpecific settings:# useradd test
SED: Line processing command, default does not modify the original file, only the data in the pattern space to do processing, after processing, the mode space to print to the screensed [options] ' addresscommand ' file ...-N: Silent mode, content
tar [-cxtzjvfppn] files and directories ....Parameters:-C: Create a compressed file parameter directive (the meaning of Create);-x: Unlock the parameter instructions for a compressed file!-T: View the files inside the Tarfile!In particular, in the
Impression, always think that as long as mastering the Linux command, natural for writing shell scripts will not be unfamiliar. This is not right. The first half of the sentence is true, it is necessary to master the Linux command, so as to write
Positional variables$ A Gets the file name of the current user script contains the path$n gets the nth parameter of the currently executing shell script if n is greater than 9 in curly braces ${10}$# gets the number of arguments for the currently
There are a number of ways to intercept strings in the shell, and there are 9 ways to use ${expression. ${parameter:-word}${parameter:=word}${parameter:?word}${parameter:+word} The above 4 alternatives can be used for default values. ${#parameter}
Linux shell& Environment variableswhen you log on to the system, a user shell is started. In this shell, you can use a shell command or declare a variable, or you can create and run a shell script program. When you run a shell script, the system
37. Adjust the properties of a variable
Read-only variable: use the readonly commandReadOnly variable Name
ReadOnly Other uses
ReadOnly or readonly-p: Displays a list of variables that currently have read-only properties
#/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= '
In the process of learning the algorithm, we will inevitably touch many and sort-related algorithms. All in all, the basic sorting algorithm must be mastered for any programmer.Starting today, we're going to be explaining the basic sorting algorithm.
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 Command and execution script, linuxshell
Http://blog.csdn.net/pipisorry/article/details/44681081
Cut all subfolders in the current folder to the current folder
For dir in $ (ls)Do# Echo $ dirIf [-d $ dir-a "$ (ls-A $ dir)"]; thenMv./$
Return values of functions in Shell#! /Bin/shSum (){Echo $($1 + $2 ))Return $($1-$2 ))}Sum $1 $2C =$ (sum $1 $2)Echo $?Echo $ cRun the command:./bashTest 11 1.The running result is:12 -- result of sum $1 $210 -- echo $? Because the return value is 10
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