Shell Script Learning (i)

Shell Script Learning (i)A) Introduction to code-style shell scripts    1. Download Xshell 5      Build a folder Mkdri Home/data;1) Look at a 1.sh built in data    See if the build was successful.2) and edit echo Hello Word, and save the launch      

Shell Script Summary

1. VariablesA: Define variable a=1, only valid for your shell processB: Define the variable export b=1, which will take effect on your shell process and its child processesC: Variables defined in the script.sh script, when source script.sh is in the

Basic monitoring menu written in shell

#!/bin/bashWhile:Doecho "1. View CPU View Memory View Disk View IP Exit Read-p "Please select menu:" ItemIf [${item}-eq 1]; Thenecho "CPU operating frequency is as follows:"Cat/proc/cpuinfo | grep MHRead-p "Enter carriage

Shell programming in the 3rd chapter of Shell Variable Foundation (bottom)

1. Two methods of setting login prompt(1)/ETC/MOTD[[email protected] thzzc]# echo this is THZZC test Linux >/ETC/MOTD[Email protected] thzzc]# CAT/ETC/MOTDThis is THZZC test Linux(2)/ETC/PROFILE.D[Email protected] home]# echo echo This is THZZC

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

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 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

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...;;*)

Lesson 22nd Basics of Shell

First, Shell introduction1, the shell is a command interpreter, providing users and machines to interact, each user can have their own specific shell,2, CentOS7 default shell for bash, and Zsh,ksh they have the difference in detail,We can check if

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

Shell Test Judgment command

Judging command testYou can use the test command to perform tests on files, strings, and so on, typically with control statements such as While,if,case"字符串测试" ? test str1==str2 测试字符串是否相等 ? test str1!-str2 测试字符串是否不相等 ? test str1 测试字符串是否不为空 ? test -n

(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 Regular Expression

Shell Common Regular ExpressionsCommon Regular expression ^ # line Header locates $ # end of row. # match any character except line break * # match 0 or more repeating characters + # Repeat once or more? # repeat 0

Shell Common shortcut keys

I. Historical order   History #查看历史命令  history-c #清空历史命令  history-w #不等退出, write the history command in the cache directly to the history command to save the file ~/.bash_history  vim/etc/profile #默认历史命令保存1000条, can be modified histsize save the

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

Arrays in the shell

Defining arraysA= (1 2 3 4 5 6)Print arrayecho ${a[@]} or echo ${a[*]}[[email protected] shell]# a=(1 2 3 4 5 6)[[email protected] shell]# echo ${a[@]}1 2 3 4 5 6[[email protected] shell]# echo ${a[*]}1 2 3 4 5 6Print the elements in an array by

Total Pages: 541 1 .... 451 452 453 454 455 .... 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.