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

Linux Shell Basics (10)

Twenty. To get the system run data through the pipeline Combination shell command :1. Output the 5 most memory-intensive commands in the current system:#1) Lists all the processes that are running on the current host through the PS command.#2) The

Shell Regular Expression

Regular expressions Used primarily for pattern split/match/Find and replace operations on strings. Regular expressions and wildcard characters Wildcard charactersThe difference between a regular and a wildcard: A regular match string

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

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, not successful

###### #时钟#!/bin/bashMin=1Hour=1for ((sec=5; sec>=0; sec--))DoEcho-ne "${hour}:${min}:${sec}s End"Sleep 1Echo-ne "\ r \ r"While ["$SEC"-le "0"-a "$MIN"-ge "0"]DoEcho-ne "${hour}:${min}:${sec}s End"Echo-ne "\ r \ r"((min--))Sec=60While ["$MIN"-lt "0"-

Shell script Remote Batch execution command

#! /usr/bin/expectset ip 10.91.96.                  ######    Network Segment Set time 30set username  root#### #for  {set ip 11} {$ip > /etc/login.defs\r "send " echo PASS_MIN_DAYS  5 >> /etc/login.defs\r "send " echo pass_warn_age 7 >> /etc/ Login.

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 scripts determine if a leap year

#! /bin/bashecho-n Input year to judge if it was a leap year:read yearlet "y1= $year% 4" let "y2= $year%" let "y3= $year% 4 XX "If [! "$y 1"-eq 0]thenleap=0elif [! "$y 2"-eq 0]thenleap=1elif ["$y 3"-eq 0]thenleap=1elseleap=0fiif ["$leap"-eq

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

Shell and regular expressions

Shell expressionWhether the-D file exists and is a directoryThe-f file is present and is a normal fileWhether the-W file file exists and is writable-s file exists and is not empty-N string string length not 0String1=string2 string Equality-eq equals-

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

Login shell and non-logon shell

Log-in Shell:Su–usernameSu-l usernameNon-logon Shell:SU usernameOpen Command Window under graphics terminalShell scripts that are executed automaticallyBash's configuration fileGlobal

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

Python3 implementation--rebound shell

First, demonstrate the effect of rebound shell0. Look at the Python version650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8B/90/wKioL1hRTinAlo_nAAASu8q0u_A128.jpg "title=" Python.jpg "style=" Float:none; "alt="

Total Pages: 541 1 .... 463 464 465 466 467 .... 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.