Linux Learning notes Chapter 8th Linux Shell Basics

Tagged with: Linux centos Shell wildcard8.1shell IntroductionThe shell is a command interpreter that provides human-computer interaction.Supports specific syntax.Each user can have their own specific shell (bash).CentOS7 default bash (Bourne Agin

What shell programming skills are required for Linux operations?

in a variety of Internet + digital era, Linux operations have become increasingly automated direction, more and more operators run in the automated operation of the road. The most popular operational automation languages currently under Linux are

Using shell script +expect to deploy SSH in bulk

Shell script +expect deploying SSH in bulkFirst, the preparation of work and ideas1, three machines to do experiments (centos6.5, ip:192.168.0.22 (master control), 192.168.0.156, 192.168.0.157)2,ip:22 this one control machine, the other 2 do the

Shell Script Programming Loop statements

ForWhileIfCase 1. for usage 1 for 变量 in 值1 值2 值3..;do 执行语句 done Usage 2for 变量 `命令`;do # 可以引用命令执行结果 执行语句done Usage 3for ((初始值;循环控制;变量变化));do 执行语句done #C语言风格的for循环用法For loop

Test conditions for Linux shell programming

Executes the command and uses the command state return value to determine certain statesecho $?0 stands for Success, not 0 for unsuccessfulTo test an expressionNumerical comparison-eq equalsThe return value is 1, indicating 2 is not equal to 3-ne

Shell Script Summary

Shell Script Summary ArraySeveral common uses of indexed arraysarray[0] array数组的第一个值array[*] array数组的所有值#array[*] array数组里数值的个数unset array[0] 删除array数组里的第一个值unset array 删除掉array整个数组Array slices: ${array[@]:num1:num2} num1:要跳过的元素个数

Shell condition judgment

1. string Judgments STR1 = str2 True when two strings have the same content, length Str1! = str2 True when strings str1 and str2 are unequal -N str1 True when the length of a string is

Shell Learning Notes (3)

If one, if base 1, single branch 1.1 syntaxif语句语法 单分支结构语法: if [条件]; then 指令 fi 或 if [条件] then 指令 fi1.2 Examples[[email protected] day4]# cat if-single1.sh #!/bin/sh#功能:单分支if结构整数比较,用-lt格式例子#created by

Shell Example: generating random integers with $RANDOM

The code is as follows:#!/bin/bash# $RANDOM 在每次调用的时候,返回一个不同的随机整数# 指定的范围是: 0 - 32767 MAXCOUNT=10count=1echoecho "$MAXCOUNT random numbers:"echo "-----------------"while [ "$count" -le $MAXCOUNT ] # 产生 10 ($MAXCOUNT) 个随机整数do number=$RANDOM echo $

Shell Script Learning (1)

Format:#!/bin/bash: Flag a shell script#Filename: first_shell.sh: File name#auto: echo "Hello Shell": role#by author h0f 2018-03-08: Author-dateecho "Hello Shell": Execute contentExecution: chmod o+x first_shell.sh./first_shell.shOr:/bin/bash

Shell-jump out of the loop break and continue

Break:Berak statements are usually used in loop statements and switch statements, and when the break statement is used in a do-while, for, and while Loop statement, the program terminates the statement following the loop. Usually the break

View Zookeeper cluster status with shell scripts

Zooper Cluster Structure:Host name roleNode1 FollowerNode2 leaderNode3 FollowerMaster ObserverScript content:#!/bin/bashfunction GetStatus () {#定义一个函数EXEC 9<>/dev/tcp/$1/2181 2>/dev/null#打开host的port a read-write socket connection that is connected

Linux Shell Basics

View the default shell types supported in Linux:/etc/shellsEcho Output command-e support for character conversions with backslash controlControl character (requires quotation marks) \\ Output \ Itself \a

A shell script that automatically installs the LNMP environment

#/bin/bash# definition of Nginx Source package version, the script will check whether the file is in the current directory according to the version name and suffix if you need to install different versions of Nginx can modify these two variables

Shell Programming------Script Example

md5

1. Batch Add UsersCreate a TXT file for the user name and password combination userdata.txt, as follows:123123 123 123 123 123The script to add the above users in bulk is:#! /bin/Bash whileRead Line Dousername=$(Echo$line |Cut-f1-d' ') #或 username=

Get disk IOPS value [Shell]

Get disk IOPS value [Shell]#!/bin/shDISK="vdc1"function getIops(){READ1=`cat /proc/diskstats |grep "${DISK} "|awk ‘{print $4}‘`WRIT1=`cat /proc/diskstats |grep "${DISK} "|awk ‘{print $8}‘`sleep 10READ2=`cat /proc/diskstats |grep "${DISK} "|awk

Shell Special Symbol command

A wildcard character? Unit # blocked command \ Screen symbol| Pipe character $ use variable ~ Home directory & put behind >> 2> 2>>Error redirection[] Array Cut segmentCut-d:-f 3, 4 charactersFiles under three and four columns-C Line-F

How to switch the shell environment

To view the commands for the terminal tool:echo $TERMThe returned results are as follows:xterm-256color To view the command for the shell environment:echo $SHELLThe returned results are as follows:/bin/bash Switch the shell environment: chsh

Shell script to Implement Bubble Sorting Code tutorial, shell script Bubble Sorting

Shell script to Implement Bubble Sorting Code tutorial, shell script Bubble Sorting Shell script to Implement Bubble Sorting Code tutorial #! /Bin/bash # capture data read strtemp = "" array = ($ str) # counterfeit bubble for (I = 1; I $ {filename}

Shell script login template description, shell script Template

Shell script login template description, shell script Template Write notepad and change the file suffix to sh #! /Usr/bin/CT # Log on to ssh # Use the ssh server spawn in combination with Alibaba CT and send Spawn ssh root @ ip # Expectation Reset

Total Pages: 541 1 .... 230 231 232 233 234 .... 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.