and so on one by one corresponds; case $MENU In Jiaozi) The echo "Your Choose is $REPLY" # # variable REPLY dedicated to storing the results of user input echo "$MEN
U Price is 20 ";;
Lamian) echo "Your Choose is $REPLY" Echoes "$MENU Price is 15";;
Mifan) echo "Your Choose is $REPLY" Echoes "$MENU Price is 18";;
Daoxiaomian) echo "Your Choose is $REPLY" Echoes "$MENU Price is 12";;
Quit) echo "Your Choose is $REPLY" break;;
*) echo "Your Choose is $REPLY" echo "Choose a
In order to check the network connection status between the daq01 and the blade server,1. Use the output rule of ping command, if can ping pass, will output 0% packet loss value; If you cannot ping the pass, the 0% packet loss is not output2. If the ping command output 0% packet loss successful execution, the network connection is OK, otherwise the network connection is not3. in Shell scripts | | For use, refer to 20360107Command1 Command2Indicates:
content such as/boot is a specific content)$?: The state returned after the previous command was executed, when the return status value is 0 indicates normal execution, and a value other than 0 indicates an exception or errorDetermine if an error occurs correctly for 0 exception error for non 0 value between 1-127$: The currently executing process/program name (which is the name of the currently executing command or program)Tip: Add Environment variablesVim/etc/profileAt the end of the document
Shell Scripting Study Guide Mechanical industry publishing ISBN 987-7-111-25504-82nd Chapter2.4Primary traps1. Today's systems, for #! The length limit for this line is from 63 to 1024 characters, try not to exceed 64 characters.2. On some systems, the command-line section contains the full path name of the command. Some systems do not, however, and the command line part is passed to the referenced program
Tag: The grep command of the Shell scripting toolgrep (abbreviated from globally search a Regular expression and Print) is a powerful text-search tool for Linux systems that can search for text using regular expressions , and print out the matching lines. Egrep and Fgrep are grep extensions that support more re- metacharacters ,fgrep is fixed grep or fast Grep.linux uses the GNU version of Grep, which is mo
How to build a archive file using shell scripting and export the signed IPA file.1. Build Script DescriptionThis shell script is used for Build,xcode workspace source code engineering and is exported as a re-signed IPA file for distributing test installation files and files for submitting AppStore audits. Implement auxiliary product development, test configuratio
tasks, you need to include the if/then criteria to judge. Shell scripting supports such operations, including comparison operations, determining whether a file exists, and so on.The basic if Condition command options are:-eq-compare two parameters for equality (for example, if [2–eq 5])-ne-comparison of two parameters is not equal-lt-parameter 1 is less than parameter 2-le-parameter 1 is less than or equal
-nand 11 use, tell read command to accept single word specifier exitCode 2-25[Email protected]:/data# cat Demo5 #!/bin/bashread-n1-p "Do you want to continue [y/n]" Answercase $answer in y|y) E Cho echo "fine,continue on ...";; N|n) echo echo "Ok,goodbye" exit;; Esacecho "This is the end of the script" [email protected]:/data#./demo5 does you want to continue [y/n]yfine,continue on]. . This is the end of the script Hidden mode read, the-S optio
equal to [-X $file] Determines whether the $file exists and has executable permissions, and the same-R test file readability [-N "$a"] determine if the variable $ A has a value, test the empty string with-Z ["$a" = "$b"] determine whether the value of $ A and $b are equal [Cond1-a Cond2] to determine whether Cond1 and Cond2 are also established,-o means cond1 and Cond2 have a set up Be aware of the spaces in the Condition Test section. there are spaces on both sides of the square brackets, and
Recent project requirements, need to write some shell script interaction, the pipeline is not enough time, expect can be very good to implement the interaction between the script, search for information, found that many articles on the Web are reproduced, I think this article is also good, so simple changes to take over and share with you ~1. Expect isSpawn: Add the shell commands you need to execute, such
to the right of the symbol.3. Expand your knowledge
The
Shell can represent the result of a command, usually assigning a value to a variable, such as the following command: # n= ' Wc-l/etc/passwd | awk ' {print '} ' # echo $n
Date also has many uses, for example: date +%h # hours 21date +%m # minutes 48date +%s # seconds 48date +%t # time 21:49:04date%w # Week 0 # from 0 Start, representing Sunday date-d "-1 day" +%f # me
????????echo?"$username?已经登录"????????echo?"fuck?,go?out?my?system"?|?write?$username????else????????echo?"$username?已经下线"????fi????sleep?3done}21, randomly generated within 10 of the number, to achieve the word guessing game, the hint is relatively large or small, equal to exit#!bin/bashlim=10let?key=$RANDOM%limread?-p??"please?input?a?number?less?than?$lim:?"?numuntil?false;do????if?[?$num?-le?$lim?>?/dev/null??]??[?$num?-ge?0??>?/dev/null?]?;then????????if?[?$num?-lt?$key?];then????????????rea
Overview:Overview:This section describes the array of shell scripting in Linux, advanced string processing, advanced variables, and configuring the user's environment.One, function and positional parameter extension1. TheShift command implements the jump in the position parameter, which squeezes the leftmost parameter650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/5B/wKiom1e9EFvAun-AAABG0xL4ac
;NBSP; value2= "fossmint.com" NBSP; if[ "$value 1" = "$value 2" NBSP;] 7, use $ (command) to do substitution command substitution is replacing the command itself with the output of this command. Use $ (command) instead of quotation marks ' command ' to do the command substitution. This is also recommended by the Shellcheck tool, which displays warnings and recommendations for Shell scripti
Shell script simulates Nginx service startup and shutdownNote: 3 slashes////is followed by a representation of the interpretation of the current statement, which must be removed in the actual script#!/bin/bash///defines which scripting language interprets the following statement[-f/etc/init.d/functions]. /etc/init.d/functions///Judge and load system functionsnginx= "/application/nginx/sbin/nginx"///nginx Se
{Command1Command2Command3}CommentsAs with the shell, the comment uses the #Replace[Address] S/pattern/replacement/flagsThis means that the part of the address line that matches the pattern is replaced with replacement.Of these, flags have several values:A number from N 1 to 512 that represents the substitution of the nth occurrence of the specified pattern in this mode.G makes a global change to all occurrences of the pattern space, and by default onl
To see what versions of the Shell:cat/etc/shells system are currently running, the first process that starts is initHow bash Shell debugs:Simply add parameters after the SH command-N: Do not execute scripts, query the grammar within the scripts, if there are errors are listed!-V: The contents of scripts are displayed on the screen before executing the scripts;-x: The scripts content that will be used is displayed on the screen, slightly different from
' test.in//Print line 3rd to 5th Sed–n '/hello/p ' test.in//print out lines containing hello Sed–n '/hello/= ' test.in//print out line numbers with Hello Sed–n '/hello/d ' test.in//delete the line containing Hello Sed Common editing commands The SED replace command uses the format "Address" s/old word/new word/"GPW" Address: If omitted, indicates that all rows are edited G: Global substitution, default means replacing only the first word to match P: Print the modified line W fname: Writes the
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.