Shell Programming (i)

Variable:1. Variable declaration eg:#:name= ' EKO '#!/bin/bashMyurl="http://www.w3cschool.cc"readonly myurl / /declare read-only variables2. Variables using eg:#:echo $name #: Echo ${name} 3. Delete variables eg:#: Uset Name4. Variable type:

Use of SED tools and regular expressions (Shell fourth day)

Sed tool "streaming editor"--Non-interactive, filter based on pattern matching and modify text--progressive processing and output of the results to the screen--can achieve the output of the text, delete, replace, copy, cut, import, export and other

Linux Shell Programming (eight): Looping structure

Looping statementsThe looping statements in the shell are as follows: for while unitl case select For/while/unitl must end with done forCycleforLoops are used to iterate through an array (data list) or

Exception handling, module package, Time module, subprocess (Invoke shell command)

Exception handlingYou can use the Try/except statement to catch an exception.The try/except statement is used to detect errors in a try statement block, allowing the except statement to catch exception information and handle it.If you do not want to

Basic Shell Command 2

2. process file 2.1 Create file TouchIf you want to change the access time only, you can use the-a parameter.$ ls-l Test_one-rw-rw-r--1 Christine Christine 0 may 14:35 Test_one$ touch-a Test_one$ ls-l Test_one-rw-rw-r--1 Christine Christine 0 may 14:

Shell Project-Alarm system

Requirements: Use the shell to customize a variety of personalized alarm tools, but the need for unified management, standardized management.Idea: Specify a script package that contains the main program, subroutine, configuration file, mail engine,

Pipe and job control, shell variables, environment variable profiles

One, pipe and operation control1. Pipe character: | (The result of the previous command output to the following command)Count the number of files after the ls command: LS |wc-lList the number of files in the/etc/directory: find/etc/-type f |wc-l2.

Experimental three shell programming (1)

One, Shell command application exercises1. Describe the purpose of the following documents①/etc/passwdpasswd is a password file that is used to manage the user's password. Ordinary users can usually only modify their own password

(reproduced) Shell script exercises

#!/bin/bash #Write a script#1. Set the value of the variable file to/etc/passwd#2. Say hello to each user in/etc/passwd and say what the ID is.#shaped like:#Hello,root,your UID is 0. FILE=/etc/passwd COUNT= ' Wc-l${file}| Cut-f1-d" "` forIinch'

Linux Shell Programming (vi): operations

Op-ExpressionsThe expression is contained in or (()) or [] within, An arithmetic expression:(()) ((expression)) This expression is calculated according to the rules of arithmetic calculation. Equivalent to let expression .

Shell Programming--for Loops

Script[[email protected] shell]# vim for1.sh#!/bin/bashfor i in `seq 1 6`do echo $idoneExecution results[[email protected] shell]# sh for1.sh123456Script[[email protected] shell]# vim for2.sh#!/bin/bashsum=0for i in `seq 1 6`do echo "$sum

Shell Programming--case judgment

Case Base Syntax:Format case?? Variable name invalue1)Command;;value2)Command;;*)Commond;;EsacIn a case program, you can use the |, meaning, or means of a condition, such as???2|3)Command;;Script[[email protected] shell]# vim case.sh #!/bin/bashread

Shell Introduction, Date command, Shell variable

What is Shellshell? Shell is a scripting languagecan use logical judgment, circular judgment and other statements;functions can be customized;A shell is a collection of system commands, such as a batch command of Windows;Shell script can

Shell Script Basics (i)

First, Shell script introduction The shell is a program written in C that is a bridge for users to use Linux. The shell is both a command language and a programming language. The shell is a scripting language; Can use logic

Shell Process Control Statements

Case statementcase $变量名 in "值1") ? 如果变量的值等于值1,则执行程序1 ;; ?"值2") ? 如果变量的值等于值2,则执行程序2 ;; ? ...省略其他分支... ? *) ? 如果变量的值都不是以上的值,则执行此程序 ;;esac ?//case反过来写"case语句的使用实例"#!/bin/bashread "please input yes /no": chocase "$cho" in "yes") ? ? echo "输入正确!";; ?"no"

Linuxday8--shell Script Programming Basics

VariableA variable is a named memory spaceAll variables in the shell are treated as character variables by default, and bash does not support floating-point variablesNaming rules for variables:You cannot make a reserved word in a program: for

Daily Shell Exercises (03)

1. ExercisesWrite a script that calculates the size of all processes in the Linux system and2. Exercise Analysis 2.1. First question, where to collect data for a processUse top or PS to get the memory usage size of each process. Once the size is

Shell Practice Applet Exercise--99 multiplication table

Recently, I was going to review the shell, just to see the shell operation, and to write a simple 99 multiplication table like a beginner. It is suggested that you can run shell scripts directly in

Shell variables and basic flow control statements

An environment variable 1 overviewThe bash shell uses a feature called environment variables to store information about the shell session and the work environment, which also allows false data to be stored in memory so that the shell can run

Nine arrays in the shell

Array: A variable that stores a set of data and is able to manipulate one of the data in this set of data individually.Types of arrays: one-dimensional arrays, two-dimensional arrays, multidimensional arraysTypes of variablesThe default value of an

Total Pages: 541 1 .... 290 291 292 293 294 .... 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.