Linux commands (11)--shell Programming II (Circular control statements)

1.if statements(1) If statement of two-way branch(2) If statement of the multi-path conditional Judgment Branch2. Test statements(1) file test(2) String test(3) Numerical test(4) Test statements combined with logical operators3.case statements4.for

Shell two number of operations, total three variables

#!/bin/bash# Simple script for two number operations A+ -, altogether three parametersEcho$# #对获取的参数以此判断是否包含 [a-za-Z] Something, if included, to exit. Because numbers add up, not numbers, or subtraction. forI_argsinch "[email protected]" Do

Shell string Expression Introduction-practice and enterprise case Scripting anatomy

Man test can see the string -n string              the  length of STRING is nonzero       STRING  equivalent to -n string       -z string               the length of string  is zero       STRING1 = STRING2               the strings are equal 

Learn Linux:shell Script (ii) about scripts

( a ) first look at how the Shell script executes, theShell script suffix is the sh file.1 sh test.sh2 Source test.shWhat is the difference between these two ways? The script in test.sh is simple , assigning a name variable after typing it from the

Linux Shell Learning Three

Shell for LoopThe syntax for the Shell for loop is as follows for inch List Do command1 command2 ... CommandN DoneExample: for inch {1.. - } do echo $i Done Class C language is also possible for ((i=1; i; i + +)) do

Shell scripts to manage multiple Tomcat instances

In order to simplify the deployment complexity of Tomcat, the previously individually configured script was presented as a parameter that can be used for multi-tomcat instance management in a stand-alone environment.Where the Deploy feature will

SHELL automatically deploys nginx and sets up a virtual host

Maple City Prodigal Original, reproduced please indicate the source!For more technical blog posts, see Personal blog: https://fengchenglangzi.000webhostapp.combh19890922QQ445718526, 490425557650) this.width=650; "Src="

Hbase Shell Basic Operations

1. StartCD /bin$./start-hbase.sh2. Start HBase Shell# Find Hadoop-hbase DFS filesHadoop fs-ls/hbase#start ShellHBase Shell#Run a command to verify this cluster is actually running#List3. Logs ConfigurationChange the default by editing

The implementation of Shell grammar exercises simple Read file

#!/bin/bashfile= "/etc/passwd" for row with $ (head-n $file) do echo "$row";   $row is the data for each row in the file ifs=:for value in $rowdo echo "------$value"; $value is passed through in each line: The content done;done after the split;Reads

Loop statements in the shell

For syntax formatfor Var in list;doCommandsDoneWhere list can contain:1) write directlyFor Alpha in a B C d;do echo $alphadone2) variablesList= "A b c D" for Alpha in $list;d o echo $alphadoneThe variable is replaced when the shell executes,

Shell Script Switch TV channel

Shell script loops over TV channel scripts#!/system/bin/shtime=$1if [[$time 0]]doecho ' run times $time "Input keyevent 166input keyevent 166input keyevent 167let" time--"Doneecho" Run End "fi  Shell Script Switch TV channel

Linux shell command

Alias:Alias ll= "Ls-l"Steps to find the command: If you are using a relative command (such as./command directly executing the command file in the current directory), locate the file directly in the current directory and execute it. Absolute

Shell CPU Utilization Memory utilization

#!/bin/bashcpu_usage_idle= ' Top-b-N 1 | grep Cpu | awk ' {print $} ' | Cut-f 1-d "." ' Let cpu_usage=100-$cpu _usage_idlemem_total= ' awk '/memtotal/{total=$2}/memfree/{free=$2}end{print (total-free)/ 1024x768} '/proc/meminfo ' mem_usage= ' echo

Use shell commands to traverse directory and subdirectory files and output to text

"Input_dir" represents the current directory, "Output_file" represents the output file, you can make your own changes according to the situation,1#!/bin/Bash2 functionGetdir () {3 forElementinch`ls$1`4 Do 5dir_or_file=$1"/"$element6

The play says Shell programming

The importance of the shell is self-evident to every system adminstrator. Today Allah is here to talk about the acid and cool shell programming of those years.let's start with an entry-level programming example. By the way with the Dora of Allah's

Linux Shell Scripts

#! /bin/bashShebang is a line of text where #! Before the interpreter path,/bin/bash is the Interpreter command path for bash.There are two ways to run a script, one is to use the script as a command-line argument for bash, and the other is to grant

Introduction to Linux Shell

What is a Linux Shell A shell is a user program, or an environment that is provided for the user to interact with the system.It is a language interpreter that executes commands that are read from a standard input device, has its own built-in shell

Linux Shell Basic Specification

Start specifying the script interpreter# !/bin/bash or #!/bin/sh Opening plus copyright information#Date: 2017-8-01 22:50#author:yang Qiang wei #Mail: [email protected] #Funtion: This is delete ... #version: 1.0 No Chinese comments in

Shell Script case

1. Write a loop to ping the IP of the entire subnet. using the while loop#!/bin/bash ip=223 While ["$ip"-ne "239"]do ping 121.201.0. $ip-c1 && echo "121.201.0. $ip yes" >> Ip_list.txt | | echo "121.201.0. $ip No" >> ip_list.txt ((ip+=1)) doneuse for

[Shell programming] Shell multithreaded operation instance

1. Demandfind all unused IPs in a 192.168.0.* network segment2. Realize We know that finding methods that do not use IP can be done using the ping command. For a single IP judgment, use the following command$Ping-C1 192.168.0.1PING192.168.0.1(192.168

Total Pages: 541 1 .... 373 374 375 376 377 .... 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.