Shell Programming-operators

1.declare commandDeclare declaring variable type: Declare [+/-][option] Variable name-: Set type attribute to variable+: Cancels the Type property of a variable-A: Declaring a variable as an array-I: Integer-X: Environment variables-R: Read-only

Shell script calls a stored procedure with parameters

Mainly has#!/bin/bashsource /etc/profilesource ~/.bash_profile################################################ ################## #功能描述: Call a stored procedure with input parameters and output parameters # Execution period: Day # crontab: * 1 * * * 

Shell's basic commands

There are a number of ways to intercept strings in the shell, ${expression} There are 9 ways to use them. ${parameter:-word}${parameter:=word}${parameter:?word}${parameter:+word} The above 4 alternatives can be used for default values. ${#parameter}

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

Shell's/bin/bash script base combat

I rookie a, first contact with the Linux shell script;Shell script, the simplest function is to write a lot of instructions together, so that users can easily be able to execute multiple commands, and shell script provides arrays, loops, conditions

Shell contains all the decompressed functions

bz2

#!/bin/sh ()  {        if [ -f $1 ];then                 case $1 in                    *.TAR.BZ2)       tar xjf $1       ;;                          *.tar.gz)        tar xzf $1       ;;                    *.BZ2)           bunzip2  $1      ;;         

Shell Script--sed Tool

SedSED: it is called a streaming editor, and its working scenario is typically in the editor, where a piece of text is read in the SED in a row and then output in the specified way, which is its most basic usage.First, the basic operation of

Talk about export and Source,bash in shell scripts.

Little brother just contact Linux, a lot of things on Linux is more unfamiliar, so write a blog, as their work summary and technology accumulation bar, but also spur their efforts to learn.The reason for today's title is to put Export,source, Bash's

Shell Scripting Exercises

First, using the shell script to implement the progress bar#!/bin/bashfunction proc ()   4 {  5     count=0   6     bar= ""   7     lable= ("|"   "/"   "-"   "\")   8     while [  $count  -le  100 ]  9     do 10              let index=count%4 11     

Shell Small Script

Ask for 1-100 and A. Non-recursive1 #!/bin/bash 2 sum=0 3 str= "" 4 for I in {1..100} 5 does 6 let sum+=i 7 str+= "$i +" 8 done 9 echo ${str%+}= $sumOutput Result:650) this.width=650; "src="

Shell scripts: Exercises

Topic 1:1-100 summationNon-recursive version:#!/bin/bashsum=0while [$val-le]dolet sum+=vallet val++doneecho $sumsum =0for i in {1..100}doif [$i = = 1]; Thenbar=${bar}${i}elsebar=${bar}+${i}filet Sum+=idoneecho $bar = $sumsum =0for ((i=1; iOperation

Use Shell to modify IP aliases for ansbile host files

#需求Original content 10.221.29.30 modified: qq1-5f ansible_ssh_host=10.221.29.30Original content 10.225.32.75 modified: qq6-10f ansible_ssh_host=10.225.32.75Original content 10.221.249.127 modified: qq11-15f ansible_ssh_host=10.221.249.127#文件展示[Email

[Shell Foundation]--echo Command

echo command: Used primarily for output in the shell 1.-N does not wrap the display result (by default, the line is wrapped) 2.-E "" supports using some special characters in double quotesThe usual special characters are\a a warning sound; \b

The shell command loops through the directory to match the keywords

#!/bin/bashwhile read Linedo for file in/home/local/test/* does if test-f $file then sed-n "/${line }/p "$file >>/home/local/out.txt fi Donedone Task: To file from the Home/local/test folder belowFile_1.logFile_2

"Shell" conditional judgment

expression format for conditional judgments:File Judging type:[[Email protected] ~]# [-E/ROOT/1] && echo yes | | echo no #注意 [] inside the space, the first command is true print Yes, otherwise print noyes[[email protected] ~]# [-F/ROOT/1] && echo

3 ways to redirect Shell files

Three ways:1.While Read lineDoDone2.For line in ' cat filename 'DoDone3.Cat FileName | While Read lineDoDoneCases:Reads data from the Math_file file, outputs the maximum, minimum, and average values1.650) this.width=650; "src="

String interception of shell scripts under Linux

1 #!/bin/bash23 str= "Http://www.baidu.com/test.htm"45 #echo ${str}The result of the operation is:http://www.baidu.com/test.htmMethod One: #截取, delete the left character, leave the right characterEcho ${str#*//}#*//means to delete the first//number

Linux Gvim Shell functions

#函数: Must be defined before using#格式:#function_name () {# List of commands# [return value] #可以显示增加return语句, if not added, the last command runs the result as a return ##返回值只能是整数, generally used for function execution success or not, 0 for success,

Linux Learning--shell

Overview What is a shell?The shell acts as an interface between the user and the Linux system, allowing the user to enter commands that need to be executed to the operating system. This is much like the command prompt for Windows, but the strong is

Shell Grammar Learning Chapter

Escape characters:650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/82/B1/wKioL1dekCOAJOxMAADJVCjDcdk147.png "title=" QQ picture 20160613180543.png "style=" Float:none; "alt=" Wkiol1dekcoajoxmaadjvcjdcdk147.png "/>When parsing text, double

Total Pages: 541 1 .... 500 501 502 503 504 .... 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.