1. Judge whether the number entered by the user is a positive integer.#!/bin/bash#判断用户输入的参数是否为正整数Read-p "Please input a digit:" intif [["$int" =~ (^[0-9]*[1-9][0-9]*$)]];thenecho "This digit is positive integer"Elseecho "This digit was not positive
1.1. usage of the Cut command in the shellThe first usage is similar to awk, as shown in awk below :Cat/etc/passwd|awk-f: ' {print $1,$5} 'Cut-d: The colon after-F 1,5/etc/passwd/-d indicates the delimiter between the fields, and-f indicates which
1.1.various Judgments1.1.1.string JudgmentsSTR1 = str2 When two strings have the same content, length is trueStr1! = str2 true when string str1 and str2 are not equal-N str1 True when the length of the string is greater than 0 ( string non-null )-Z
first, the circulation 1. Indefinite circulation There are two kinds of forms: while [Condition] state in parentheses is the beginning of the loop of the judgment do done do is the end of the loop When the condition condition is established,
vim/root/7.sh#!/bin/bashX=$[RANDOM%10+1]Read-p "[1-10] you guessed:" CaiIf [$cai-eq $X];thenEcho, congratulations on your guess.Exitelif [$num-gt $X];thenEcho's a big guess.ElseEcho's too small.Fivim/root/6.sh#!/bin/bashRead-p "Please enter a
The shell in Linux is an outer-layer protection tool for the Linux kernel and is responsible for completing the interaction between the user and the kernel.A command is a text stream in which a user issues a control request to the system kernel and
The use and setting of a variable (note that there can be no spaces before and after the equals sign)1. ReadRead the input from the keyboard assignment to the variable, using the following method[Email protected]:/opt/android-sdk/sdk/# read
When you write a shell script, you encounter some long-awaited commands, and to make the user look more comfortable, add some display to make the script appear to be running instead of stuck.So I did my own research and wrote the two scripts to
Shell Pass ParametersWe can pass parameters to the script when executing the Shell script, and the format of the parameters obtained in the script is:$n. n represents a number, 1 is the first argument to execute the script, 2 is the second argument
1. Standard input, standard output and standard error outputLinux system open 3 files, standard input, standard output, standard error output.Standard input: Enter data from the keyboard, i.e. read data from the keyboard.Standard output: Outputs the
Kali System Preparation:Copy the following Ruby code into the/USR/SHARE/METASPLOIT-FRAMEWORK/MODULES/EXPLOITS/WINDOWS/SMB/MSH_SHELL.RB directory (note the code indentation OH):# # # This module requires metasploit:https://metasploit.com/download#
The shell commonly used file judgment operators are as follows:-e file is present-F file is a normal file (not a directory, device file, linked file)-S means that the file size is not 0-D Indicates whether the file is a directory-B indicates a block
Function of script programming:Function: FunctionsStructured programming, cannot run independently, needs to be executed when called, can be invoked multiple timesDefine a function:function FUNCNAME {Command}FUNCNAME () {Command}Custom execution
Command line and Shell: the command line refers to the interface that provides user input, which itself simply accepts input and then passes the command to the command interpreter, which is the shell.Note: The command line and file for Linux are
The set command functions primarily to display shell variables that already exist in the system, and to set new variable values for shell variables. The set command is not able to define a new shell variable. If you want to define a new variable,
Beta version: Easy cool cms2.5Contains a sentence: Http://localhost/ekucms2.5/?s=my/show/id/{~eval ($_post[x])}will generate an error log in the/temp/logs/directory of the website, naming rules for the year _ month _ DayError log contentsContains
First, the basic regular expression1. Regular expression: The regular expression is the string used to match the symbol condition in the file, and the Regex contains the matchinggrep, awk, sed, and other commands can support regular expressions.2.
Demand:Bulk delete users using the For loop[Email protected] ~]# Cat/etc/passwdroot:x:0:0:root:/root:/bin/bash. stu01:x:1001:1001::/home/stu01:/bin/bashstu02:x:1002:1002::/home/stu02:/bin/bashstu03:x:1003:1003::/home/stu03 :/bin/bashstu04:x:1004:1004
? Runtime.getruntime (). EXEC (cmdstring), if the parameters in cmdstring at this time (such as the CP file file name) contain special symbol spaces, then an error occurs, because the source code will follow some special characters ("\t\n\r\f",
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