One, pipe and operation control1, the pipe symbol "|", is to put the results of the previous command run to the following command.LS |wc-l; LS |grep test2, how we are editing a file, want to pause this operation and exit can enter Ctrl Z Pause task3.
1. For Loop statement:Two common ways to use for: notation (1): for inch 1 2 3 4 5 (PS in $ (seq15 in {1). 5 }) do echo"$val " DoneNotation (2): for ((i=0;i; i++)) ( PS: Must Be for (()) ) { "val=i%2"
Determine if b.txt This file exists, there is output 1, there is no output 0[-F B.txt]&& echo 1| | Echo 0-F: Determines whether the file is-E: Determine if the file exists-D: Determine if the directory-R: Judging whether it is readable-W: Determine
The main purpose of this blog post is to facilitate the installation of GNOME extensions for me and you. I've listed all the extensions I've installed here.
Common extensions
Clipboard Indicator
https://extensions.gnome.org/
1, for: Read different variable values, execute the same set of commands one by one, until the value is complete exit, variable values are separated by a spaceSyntax: For variable value in value listDoCommandDone2, while: Repeated testing a
The first line of the shell script illustrates the path to the interpreter: #!/bin/bashRun the script two ways: Use the bash command to run the shell file, or grant the script file execution permissions, you can directly execute the fileWhen the
1, test: the detection of the expression is established, the return value is 0, otherwise, not 0Method:1) test expression2) "Expression"2. File test:-D: Whether it is a directory-F: Whether it is a file-E: whether there is-r: Whether Read permission
LinuxSmall Brackets()and curly braces{}is the execution of one of these commands, but there is a certain difference, and its specific meaning is as follows:(): Commands within parentheses are executed in a child shell (()): Compare and calculate the
8.6 Pipe symbol and job controlThe effect of a pipe character is to drop the result preceding the symbol to the command following the symbol. Not all commands are available after the pipe character, and generally commands for document operations are
Shell Basics
What is a shell?
Shell is a command-line interpreter
The shell is also a very powerful programming language that can invoke Linux commands directly in the shell
How the script executes
SED replaces a string in a fileSed-e ' s/foo/bar/' myfile replaces the first occurrence of each line in the MyFile file foo with a string bar , and then outputs the file contents to the standard outputSed-e ' s/foo/bar/g ' myfile g allows SED to
The test command in the Shell is used to check if a condition is true, and it can be tested in three aspects of numeric, character, and file.Numerical testParameter description-eq equals True-ne is not equal to true-GT is greater than true-ge is
Implementation of dependency processing and parallel compilation of Docker image under shellRecently, when making a series of Docker image compilation scripts, I thought we could not speed up the parallel compilation, checked the data, and finally
Linux Modify shell command prompt and color1. Load the configuration file sequence during the Linux login process:/ETC/PROFILE→/ETC/PROFILE.D/*.SH→~/.BASH_PROFILE→~/.BASHRC→[/ETC/BASHRC]You can view the default ~/.BASHRC file as follows:[Root@~/wade/
Sync Post: http://blog.hacktons.cn/2017/12/13/shell-func-return/BackgroundWith Shell programming, custom functions are often required to write some tools for batch processing. In the case of more complex points, it may be necessary to return a value.
1211shell
High wavesArchive: Learning NotesDecember 11, 2017 13:10:56
Shortcut keys:Ctrl + 1 title 1Ctrl + 2 title 2Ctrl + 3 title 3Ctrl + 4 ExampleCtrl + 5 Program CodeCtrl + 6 Body
Format Description:Blue
$ () and ' (anti-quote)In the bash shell, $ () and "(anti-quote) are used for command substitution.$ echo the last Sunday was $ (date-d "last Sunday" +%y-%m-%d)Get the date of the previous SundayThe reason for using $ ()
' (anti-quotes) is
Summary
The attribute of an array is a set of identical data types, although the shell is a weak type, but we can also divide its array into 数据类型的数组 字符串类型的数组 two categoriesSeparating the shell array elements from each other 空格
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.