(vi) write a first shell

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

Shell script exercises Basic Article 2

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"            

[Shell Foundation]--sort Command

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

Shell condition Test

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

Linux Shell Basic Command

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.

Shell Simple Usage Notes

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

String interception under Shell

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

"Shell" multi-Command execution order

; for example[Email protected] ~]# date;dd if=/dev/zero of=/home/1 bs=1k count=10240;date # #统计dd命令消耗时间, where/dev/ Zero empty file Tue June 15:15:02 CST 201610240+0 Records in10240+0 records out10485760 bytes (ten MB) copied, 0.0224696 s, 467 M

A simple description of the shell variable

$*[Email protected]DifferenceThe shift parameter moves forward one bit, moving the position variable.$?$n$#$$!$$#!/bin/shPidpath=/tmp/p.pidIf [-F "$pidpath"]ThenKILL-USR2 ' Cat $pidpath '/dev/null 2>&1Rm-f $pidpathFiecho $$ > $pidpathSleep 300One of

Shell syntax in makefile

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

The path is not shown in the Linux shell and is shown as two solutions for-bash-4.1#

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

Shell syntax-shell defining variables and calling variables

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,

How the shell intercepts strings

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,

CentOS builds local Yum source shell script

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

Basic knowledge of Shell programming

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

Linux Shell Condition Test

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

Shell Script--Determine if the IP entered is correct

#!/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地址是否仅由数字和点组成,

Shell Script--Guess number

#!/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

Shell Scripting Exercises

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

Hill sort (Shell sort)

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

Total Pages: 541 1 .... 526 527 528 529 530 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.