Conditional testing of Shell programming

Condition test(a) Concept: to determine the specific conditions to determine how to perform the operation, when the condition is set, the return value of the test statement is 0, otherwise, the other value, meaning if the echo $? The value is 0,

Shell Programming Learning 2--Command Daquan

There are a number of commands in Linux that can be divided into 10 categories (see [1]): 1) file management; 2) document editing; 3) file transfer; 4) Disk Management; 5) disk maintenance; 6) network communication; 7) system management; 8) system

The grep command of the Linux shell

grep commandgrep Example:[OPTIONS] PATTERN [FILE ...][Email protected]:~# grep ' root '/etc/passwd root:x:0:0:root:/root:/bin/bash [email protected]:~# grep "$USER"/ ETC/PASSWD Root:x:0:0:root:/root:/bin/bash [email protected]:~# grep ' whoami '/etc/

Shell shortcut keys

Ctrl + A cursor moves to the beginning of the lineCtrl + E cursor moves to end of lineCtrl + R Search in the history commandCtrl + L Clear ScreenCtrl + U Clear the cursor to the beginning of the characterCtrl + K Clears the character of the cursor

Input and output in the shell (Bash Shell 03)

Input and output in the shellStandard input: KeyboardStandard output: Terminal displayThe >> append is a newline appendEcho- n do not trailing line breaks-e enable escape function to interpret backslashes-e disables the escape function that

Mac Setup shell script boot from

Recently need to do a distributed architecture of the site, is currently in the debugging phase, each time the boot to start a lot of tools, such as Zookeeper, ACTIVEMQ, Redis, Nginx and so on, take pains.Search the Internet on the Mac how to set up

Shell Problem Solving

If you want to find common commands, please click on the imageThe instructions in the shell script, in the uncertain case, do not arbitrarily use nohup, otherwise it may have disastrous consequences, such as-memory explosionShell random function

Shell for usage

#!/bin/shFor1 () {For I in 1 2 3 4 5 6Doecho "$i"Done}For1#!/bin/shFor2 () {For i in {1..10}Doecho "$i"Done}For2#!/bin/shFor3 () {Sum=0#int =1For i in {1..100..2}DoLet "Sum+=i"Doneecho "Sum is $sum"}For3#!/bin/shFor4 () {Sum=0For I in $ (SEQ 1 2 100)

Shell gets the file name under the specified directory

There are two directories A, B, two folders directory of some files are the same name, but the suffix is different, I want to a folder and B folder with the same file name of the files covered to B, and delete the name of B and different suffix file,

Linux Shell Programming II

With "'"""todayis" ' date ' preceded by a character, followed by ' date ' Represents the Execute Date command. PDATE=""'date'is Date" Expr " is used to calculate the result of a=9b=tenvar1= $a +$becho $var 1 output is "9 +10"expr" is used

Shell Study Note

5.1 Printenv View Global variables Bash New shell Set Global variables and localvariables Export Test Local→global, so it can be

Shell reads file contents

Shell scripts that perform fast and easy to understand code. In the process of writing shell code, it is often used to read the file contents. Notation One:----------------------------------------------------------------------------#!/bin/bash while

Turn (Linux shell)

Please put the following stringstu494e222fstu495Bedf3stu49692236stu49749b91Switch to the following form:stu494=e222fStu495=bedf3stu496=92236Stu497=49b91Question 2:Echo I am Oldboy training, please put the output of each character to the order,

Shell script to check if host is alive

1#!/bin/Bash2prefix=192.168. the3num=14 while["$num"-lt"255"]; Do5 Echo-en"Pinging ${prefix}.${num} ..."6 Ping-c1-w1-t5 ${prefix}.${num} >/dev/NULL 2>&17 if["$?"-eq"0"]; Then8 Echo "OK"&&Echo"${prefix}.${num}" >>Ok.txt9 ElseTen Echo "Failed"&

Shell Small Problem Summary

Writing a script today meets a strange thing.Variable A is definedIf [-a $a];then echo "exists"; else echo "not exists"; fiResult output:ExistsIt's a blind moment, but it's going to change.If [-a "$a"]Of course, a here is a script input parameters,

Common Shell Instances

1. Exclude portions of files from disk usage statisticsDu--exclude "*.iso" dir2. Find the maximum of 10 files in a specified directoryFind-type f-exec du-k {} \ |sort-nrk 1 |head-n 103. List the maximum 10 commands for the current systemCat.

Color Ball of shell scripts

The first thing to know is how to play color ball: 6 red balls (1~33) and a Blue ball (1~16) to choose a so-called 6+1To generate 6 random numbers between 1~33 and cannot be equal, this is key if you use traditional judging methods (the first with

Shell script-Backup According to the number of files (reprint)

#!/bin/bash############################### #FileName: Backuplogtimer.SH#Function: Scheduled backup log file #version:0.1#Authon: xueya#date:2014.06. -############################### #获取当前路径path=`pwd`Echo "current1 path: ${path}"#循环执行 while[[1-eq1 ]]

Shell randomly generates 10 numbers to find the maximum value

Analysis: Randomly generate 10 numbers? Generate a random number, here with the random function, I define the generated 10 numbers as an array of arrays, the initial value of the definition max is array[0] use for loop to compare with each element's

Linux Beginner: A simple shell script

What is a shell?The shell itself is a C language program, it is the user use Unix/linux Bridge, most of the user's work is done through the shellThe shell has two ways of executing commands:Interactive (Interactive): Explains the execution of a user'

Total Pages: 541 1 .... 410 411 412 413 414 .... 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.