#! /Bin/bashPnum_server = 'ps-WEF | grep Tomcat | grep-V grep | WC-l'If test $ pnum_server-LT 1Then/Usr/local/tomcat/bin/shutdown. ShSleep 2 S/Usr/local/tomcat/bin/startup. ShFi
There must be spaces between square brackets and expressions.
Put the
BASH Shell is the default shell in Linux. It can be supplemented by tab, and historical commands such as up/down key switching are easier to use than the default KSh shell in Aix (most Unix systems.
All Linux software that can be installed under
Let's take a look at some common shell tips.
CTRL + u Delete the cursor to the beginning of the current row
CTRL + k Delete the cursor position to the end of the current row
CTRL + a move the cursor to the beginning of the current row
CTRL + e
Preface:
WhateverProgramming LanguageConditional judgment is indispensable. Shell is no exception.
If list thenDo something hereElif list thenDo another thing hereElseDo something else hereFi
Ex1:
#! /Bin/sh
System = 'uname-S' # obtain the
Browse the structure of this website and find the http://www.fzz8.cn/index.asp? Id = 14 such an interface, add a single quotation mark http://www.fzz8.cn/index.asp behind? Id = 14' after you press enter (figure 1)
The SQL injection
Bash
Shell has two popular shortcut key styles: emacs-based and VI-based, and can switch between them.
Set-o vi # Switch to VI StyleSet-O Emacs # Switch to the Emacs Style
It is based on Emacs by default, which I like very much. After all, I
I. Use of local variablesLocal variables act only in this shell, just like local variables. It does not affect variables in other shells.
1. Show variable valuesYou can use the echo command. Note that you must add the $ symbol before the variable
Write a shell script to check whether a process is running
1 #! /Bin/ Sh 2 3 Cmd = Pgrep 4 # Process name 5 Pproc = Test 6 # Loop, to keep the script running for monitoring 7 While : 8 Do 9 If [-N " '$ Cmd $ pproc' " ] 10
Eclipse on Mac often needs to manually close the Java Process, which is a little troublesome. Write a simple shell in. bash_profile and use the port number to close the process.Lsof-Ti: 9001.Then $ source. bash_profile can use the killps command.
Linux Shell is much more powerful than Windows batch processing in programming, whether in loops or operations. Data Types cannot be compared. The following is a summary of some operations on the array when I am using it.
1. array
Folder, Start Menu folder, and personal document folder.
SyntaxWshshell. specialfolders = obw.shspecialfolders
Example'This code fragment shows how to access the Desktop FolderSet wshshell = wscript. Createobject ("wscript. Shell ")Msgbox "your
"Back" | "tab" | "clear" | "return" |
"Escape" | "space" | "prior" |...
The names of all keys can be found in winuser. h. The hotkeys are case insensitive.
The hotkey can only activate shortcuts on Windows desktop or Windows Start Menu.
Windows
#! /Bin/shwebsite [0] = 'zufang .hfhouse.com/chuzu/' # Website 1 mobile [0] = '000000' # Website 1 mobile number website [1] = 'oldhouse .hfhouse.com/chushou/' # Same as 2 mobile [1] = '000000' # Same as above 2 # and so on, if there are too many
Reference: http://feidaodalian.iteye.com/blog/697158It is said that this is an unsolved bug of the SSH Secure Shell client for many years. Both the client and the server must be 'utf-8' encoded.Find information on the Internet and find a simple
By default, operations in Shell programs are string operations, and unexpected answers may be obtained when you want to run mathematical operators:
Var = 1Var = $ var + 1Echo $ VaROutput:1 + 1
From this example, we can see that the shell string
Why should I quit? Why should I quit? Why can't I exit with exit? Why... yes, shell does exit with exit, but, however, what we're talking about is not that cheap...
In our daily work environment, there is such a characteristic. We will first log
CTRL + P repeat the previous command
CTRL + a jump to the first character
CTRL + x same as above, but once again, it will return to the original location
CTRL + B move one character forward without deleting characters
CTRL + H Delete the previous
Use the if statement to determine parameters in shell programming
-B. returns true if the file exists and is a block file.
-C: returns true if the file exists and is a character file.
-D. If pathname exists and is a directory, true is returned.
-E:
In Linux, although there are various graphical interface tools, shell is still a very flexible tool. Shell is not only a collection of commands, but also a very good programming language. You can use shell to automate a large number of tasks. shell
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