1, editor, compiler, Run method (3 ways to execute the script)(1) Shell program is text format, as long as the text editor can be. But because our shell is running under a Linux system, the line break must be ' \ n ' and the line break under Windows
Practice 2, write a script/root/bin/yesorno.sh, prompt the user to enter Yes or no, and determine whether the user entered Yes or no, or other information #!/bin/bash # case $1 in yy]| [YY] [EE] [Ss]) echo "You put a $1"
Sort commandSort is output in ascending order of ASCII code, and is compared sequentially from the first characterCommon options-C test file is already sorted-R Reverse Sort-N Sort by numeric numeric size-t Specifies the separator-K Specify Domain-U
The shell condition test can be done in two ways:Test parameters Testing Content[Parameter test content]First, test file type:TEST-E file name (test file exists)[-e FileName] Test file exists, note the space on both sides of the bracketTest-f file
Learning basic Linux Commands
Command
Description
$ ls
This command was used to check the contents ofThe directory.
$ pwd
This command was used to check the presentWorking directory.
One, the main use of the Bash Shell in Linux; View the supported shell types available on Linux systems :Vim/etc/shellThe way to perform shel footsteps:1. Give footsteps the ability to execute permissions and invoke the script using a relative or
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/82/E0/wKioL1djmxjx5LUrAACG8N3z-pA754.png "style=" float: none; "title=" 0.png "alt=" Wkiol1djmxjx5luraacg8n3z-pa754.png "/>The maximum, minimum, and average values of a set of numbers are
Writing shell code in makefile is a bit weird, unlike shell syntax, and if you don't understand it, it can be confusing to see makefile. Here's a summary of some.1: The code that is the same line after the colon of the target item of the makefile
This problem occurs because there is no configuration. Bash_profile problem, or we accidentally emptied or deleted the. bash_profile file.Method One: Modify the ~/.bash_profile fileThe steps are as follows:Vim ~/.bash_profile(No tube. Bash_profile
In the first line of the executable, we usually specify what interpreter to use to execute the file, such as the shell script, the beginning of the file is usually #! /bin/shRunning the shell will encounter three variables1. Local variables,
Summary of Shell interception string methods in LinuxHow does [Linux] calculate string lengths in shell scripts?There are eight ways to intercept a string, mainly for the following methodsThere are a number of ways to intercept strings in the shell,
How to use:1. Download the deltarpm-version.el6.x86_64.rpm python-deltarpm-version.el6.x86_64.rpm createrepo-version.noarch.rpm for the system version , put it in the sibling directory corresponding to the script.2. Take the rpm that needs to be
1. Use the editor to write a file, which is the command entered in the shell, can be used through the PATH environment variable reference to the command.#! /bin/sh #! The following parameter is the program used to execute the script#后面是注释The rest is
Conditional test Method OneTest command:if test $n 1-eq $n 2then "Thenumber isequal"fi[] Commandif [$n 1-eq $n 2]then " The number is equal " fiThe test command and [] are equivalent in bash.Condition test Mode Two((expression)) test the
#!/bin/bash#It ' s written by Caibingsen#!/bin/bash#It ' s written by Caibingsen#date: 2016-03-15#while设置成死循环, re-enter when the IP entered does not meet the criteriaWhile:DoRead-p "Please enter the IP address to be judged:" IP#判断输入的ip地址是否仅由数字和点组成,
#!/bin/bash#It ' s written by Caibingsen#Date: 2016-03-15# # Function: Guess the number in the 0-9 range# # Requirements: 1, automatically generate a number each time# # 2, guess wrong five times auto exit# 3, guess the automatic exit# # 4, input
1. List the directory under the current directory (only one level is required)1 #!/bin/bash 2 for f in ' LS ' 3 do 4 if [-D $f] 5 then 6 echo $f 7 fi 8 done2, the current directory of files (only need a level) listed1 #!/bin/bash 2 for f in ' LS ' 3
1. DefinitionThe Hill sort (Shell sort) is a sort of insertion. Because of D. L The shell was named after it was introduced in 1959.2. Basic IdeasFirst, take an integer less than n D1 as the first increment, dividing all the records of the file into
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