Shell Programming (III)

Create a script admin.shPerform the following functions:-H | --HELP: Providing Help information--add users: Completing user additions-del User | --delete: Complete User deletion-V: Turn on debug mode, display informationYou can use all of the above

Eight using Shell functions

in the In a Shell script, some operations that need to be reused are defined as public statement blocks, which can be called functionsWhat are the benefits of using functions? Make script code more concise, enhance readability and improve execution

Shell Scripting Basics (eight)

One, expect script synchronization file[[email protected] ~]# cd /usr/local/sbin/[[email protected] sbin]# ls01.expect 02.expect 03.expect check_ng.sh lvs_dr.sh lvs_nat.sh mon nginx_log_rotate.sh[[email protected] sbin]# vim 04.expect

Linux shell string manipulation

Recently in the shell script, found some shell strings of the Sao operation, can improve efficiency.String Read ${var}: Value of variable var ${var-default}: If Var is not declared, the value of Var is $default ${var:-default}: If

Pipe and job control, shell variables, environment variable configuration files

Pipe character | Function: The output of the preceding command is given to the following command job control CTRL Z pauses a task [[email protected] ~]# vim 1.txt [1]+ 已停止 vim 1.txt[[email protected] ~]# vim 2.txt [2]

Shell Script Basics (v)

First, the alarm system main script[[email protected] ~]# cd/usr/local/sbin/# #脚本基本都放在这个文件夹下, convenient management [[email protected] sbin]# mkdir mon## Create a monitoring script home directory [[[email protected] sbin]# CD mon[[email protected]

Shell Learning (iii)

Libvirt Tools for managing the KVM itselfVirt-install installation packages for installing virtual machines, installing virtual machinesVirt-mananger: Managing a tool to create a delete virtual machine---restore content starts---1 Grep-e "SVM | VMX "

Shell Learning (iv)

One, character interceptionExprBasic usageExpr substr $var 1 starting position for the length of the Intercept, such as:[Email protected] mnt]# a=centos6.9[Email protected] mnt]#[[email protected] mnt]# expr substr $a 1 6CentosCutBasic usage:Command

24th Lesson Shell's special symbols and Cut_sort_wc_uniq_tee_tr_split commands

First, special symbols' * ' wildcard character, any of any characters'? ' any one character' # ' comment characters' \ ' de-semantic characters' | ' pipingThe prefix of the ' $ ' variable'!$ ' combination, regular inside means end'; ' multiple

Shell implementation compresses multiple files

Write a script in the Linux environmentFrom the keyboard to let the user enter several files, the script can archive this several files into a file:1. First introduce the CASE statement formatCase SWITCH invalue1)Statement...;;value2)Statement...;;*)

Custom functions in the shell

Customizing a function for printing function parameters[[email protected] shell]# vim fun1.sh#!/bin/bashpri(){ echo "第一个参数为 $1" echo "第二个参数为 $2" echo "文件名为 $0" echo "总共有$#个参数" }pri a b #调用函数Execution

Shell Learning variables and quotes

1. The concept of variables: variables are stored in the program of the user's memory space, the variable name is the address of this memory space, the value of the variable is stored in the computer memory. Variable definition: It is simple to

8.1 Shell Introduction 8.2 command History 8.3 command completion and alias 8.4 wildcard 8.5 input/output weight

8.1 Shell Introduction: Can be divided into interactive and batch processingInteractive: The user executes a command every input immediatelyBatch: The user writes the full shell script in advance, and the shell executes many commands of the script8.2

Shell Script 3

A variable in a shell script means that the command itself can represent a soft connectionShell variablesParentheses can only affect variables in parentheses because the parentheses open the child shellCurly braces affect variables outside the

(a) The first day of the shell

CentOS default shell version: Bashecho $SHELL Opening language ID: #!/bin/bash在执行bash脚本的时候,内核根据#!解释器来确定改用哪个程序解释这个脚本中的内容 Script comments在shell中,#开头的是注释; Execution of Shell scripts方式一:bash script-name或sh script-name (推荐使用)方式二:./script-name

Shell Script Programming Learning notes-for loops

1.FOR Loop structure 1.1 for loop structure syntaxGrammar:For variable name in variable Value listDoInstructions...DoneTip: In this structure, "in variable Value list" can be omitted, when omitted is equivalent to in "[email protected]", using for I

Shell+ nailing robot to complete the Java program after the interrupt self-start and real-time monitoring

Java real-time program in the process of occasional abnormal information interruption in the case, through the shell script to complete the self-boot.The following is a shell script that monitors a real-time Java program.Determine if the program is

Shell script from getting started to complex Quad (array)

multiple values can be stored in an array. The Bash Shell supports only one-dimensional arrays (which do not support multidimensional arrays), and the subscript for array elements starts with 0. The Shell array is represented by parentheses, and the

Bubble sequencing of shell programming

This is a shell script practiced hand program that exercises the use of a for statement#! /bin/bashn=0while read arr[$n] #通过键盘给数组赋值 ... The first element of the array is saved in arr[0] ... Enter indicates the input interval for the element, ctrl-d

Shell functions and arrays

[TOC]Shell functions and arrays one, Shell function 1.1 function format 1function name { commands}Example 1:#! /bin/bashfunction inp(){ //定义一个inp的函数echo $1 $2 $3 $0 $# }inp 1 a 2 b //传入参数 //传入参数Run

Total Pages: 541 1 .... 396 397 398 399 400 .... 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.