single quotation mark is just a special symbol for the value of a variable as the $ symbol within the double quotation mark itself. Using export, you can change a variable to an environment variable so that it can be used by more than one process, such as a child process. Use the unset command to cancel a variable. With the env command, you can view all environment variables, and the SET command can view environment variables and custom variables.Variables can be entered through the keyboard, d
This article is part 3 of the fifth chapter of "Learning the bash Shell" 3rd Edition, Flow Control, but we will not limit this article. Flow control is a very common part of any programming language, including case. Here, we will continue to learn about them.
Case checks whether the string style matches and the number is equal to each other for different processi
Learning and using bash shell shortcuts
By fenng|It can be reproduced. During reprinting, it must be indicated by a hyperlink.ArticleSource and author information and copyright notice Web: http://www.dbanotes.net/techmemo/shell_shortcut.html
This articleBASH Shell shortcuts. It is worth
variable that is only valid for code snippets within a function locally a=1title: Bash xxxx.SHInput-T5represents a triangle with 5 lines of paint-L7represents a draw slash 7 lines #!/bin/Bashtriangle () { forXinch$(seq 1$1) Do forYinch$(seq 1$(($1-$x))) Do Echo-N" " Done forZinch$(seq 1$((2* $x-1))) Do Echo-N"" DoneEcho Done}line () { forIinch$(seq 1$1) Do forXinch$(seq 1$
1. What is shell?The operating system interface. The shell can call the corresponding hardware through the kernel.2. What is Bash?Bourne again shell (BASH) is actually a version of shell.3. BA
1. what is the shell Operating System Interface? through shell, you can call the corresponding hardware through the kernel. 2. what is Bash? BourneAgainSHell (bash) is actually a version of shell. 3. BashShell functions: 1) command compilation (Command history);... 1. what i
This article is also the fifth chapter of "Learning the bash Shell" 3rd Edition, Flow Control, 4 of Reading Notes, but we will not limit it to this. Flow control is a very common part of any programming language, including case. Here, we will continue to learn about them.
The select statement is different from other flow control statements. There are no similar s
) printf "restarting...\n" sub_stop sleep 1 Sub_start sleep 1 sub_status; status) Sub_status;; *) printf "Usage: $ {start|stop|restart|status}\n" exit 1;; Esacexit 0 This is a generic startup shell script, the main idea is to launch the specified application (the above code, the application to be enabled for Netty-sample, you can modify it yourself), the first to find the process ID, and then saved to the PID file, so that after the detection of the P
have an error message in your script, you can redirect a separate line of output to stderr. All you need to do is redirect the output information to the stderr file descriptor using the output redirection character. When redirecting to a file descriptor, you must precede the file descriptor number with a :echo "This was an error message" >2 Permanent redirection: Use the EXEC command to tell the shell to redirect a specific file descriptor during the
The/etc/passwd file contains a list of all system user accounts and basic configuration information for each userUser name: Password: uid:gid: User's full name: User's default working directory: User Default shell programBy default, the bash shell automatically processes commands in the. bashrc file under the user's home directory when it starts.It often sets the
-b. Specifies the small file size.-lSpecifies the number of small file rows.PREFIXprefix for small files. The ability to optionally specify a string that is defined for itself.
14, Xargs
xargsRead the standard input, separated by a space or line break, separate the standard input into multiple parameters, and then run the specified command, such as the following:
command
For example, the following command,/tmpunder the folder to findcorethe name of the file,
device, you cannot uninstall the device fileThe lsof command can obtain process information for using a device file, stop the process, and then uninstall the device fileDfUsed to view the usage of all mounted disksThe Linux system has a process in the background that processes files or uses files. The output value of the DF command shows the current value that is considered by the Linux system. It is possible that a running process on the system has created or deleted a file, but the file has n
number2. Settings and references the first way to set up: references: [[email protected]~]# a[0]=1 Echo${a[0]} [[email protected]~]# a[1]=2[[Email protected]~]# a[2]=3Subscript starting from 0, 0 represents the first second setting: [[email protected]~]# b=(a b c) [[email protected]~]#Echo${b[0]}a[[email protected]~]#Echo${b[1]}b[[email protected]~]#Echo${b[2]}c[[email protected]~]# b= (a B c [ -]=carol)--You can skip a few elements directly to the 51 assignment [[email protected]~]
This article is also the fifth chapter of "Learning the bash Shell" 3rd Edition, five of Flow Control's reading notes, but we will not limit it to this. Flow control is a common part of any programming language, including while and util, which are also common in advanced programming languages. Here, we will continue to learn about them.
The while and util syntaxe
1. shell scripts and function scripts are files that contain shell commands. They are a shell program and run in three ways: one is to type source scriptname to read and run the script commands, just like typing them. Second, run bash scriptname and open a sub-shell to read
This article is also the seventh chapter of "Learning the bash Shell" 3rd Edition, "Input/Output and Command-Line Processing", four of the Reading Notes. Our goal is to read books thin. We will examine how the Linux system parses bash.
Step 1: The command is assigned as a token based on spaces, tabs, NEWLINE,;, (,)
Historical command History-C Clear-W Write ~/.bash_historySave 1000 By default, can be modified in /etc/profileCall TAB completioncommands, directories, files
Command aliasesAlias aliases = ' Original command 'Command execution order:Absolute path or relative path > alias > Bash's internal command > The first command found in $PATH environment variable (external command)Configuration file:/ROOT/.BASHRCDelete: Unalias aliasesCommon shortcut keys
Input and output redir
Here is an example of a simple tag, throw this question, and then add the complete.The parsing order of bashExample:[Email protected]:~/sh_test$ sudo awk ' nr==1 {print $} '/etc/shadowRoot:!:16141:0:99999:7:::[Email protected]:~/sh_test$ sudo awk ' nr==1 {print $} ' -bash:/etc/shadow: Insufficient AuthorityWhy does the above command 2 add a file input to the redirect and there is not enough permission. Cause: Add Linux
Write a second shell script today and write the after-class questions in "private cuisine". The problem needs to write a check whether a name exists, does not exist to create a file, there is a need to determine whether the name of the file, the file is deleted after the creation of a directory with the same name, if the directory is to delete this directory.First set up a basic condition: The Operation directory is/tmp/test/(note: If this directory d
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.