Because the shell script is used in the project, the system looks at it a bit. Previously, it was a general understanding. Variables: Environment variables, pre-defined variables, positional variables, custom variables. Environment Variables This
If condition test Type: File test, digital test, string testIf statement structure:
If ...; Then ...; Fi
If ...; Then ...; else ...; Fi
Conditional test expression:
[Expression]
1. Monitoring commands (run once every 2 seconds)watch "ls -larth"2. Kill the program with one portsudo fuser -k 8000/tcp3. Limit the memory usage of the following commandsulimit -Sv 1000 # 1000 KBs = 1 MBulimit -Sv unlimited # Remove limit4.
The shell is an interface between the user and the system in a Linux system, and it is a high-level programming language, in addition to being the command interpreter. In the Linux command described earlier, the shell appears as a command
First, the basic command1. Immediately shutdown and restart, execute the following command: Shutdown-r now or reboot2. Immediately shutdown, execute the following command: Shutdown-h now or Poweroff3, wait 2 minutes shutdown and restart, execute the
CCat Zdd Browse the contents of a ZDD fileCat Zdd1 Zdd2 Browsing the contents of multiple filesCat-n ZDD Browse the contents of a file Zdd and display line numbersCD back to the start directory, that is, just logged into the system directory, CD
Touch commandThe touch command is used to create empty files, such as when an application wants a log file to exist before they can write to the data. You can create an empty file with the touch command: touch test1 ;The touch command can also be
1. Generate a random password (urandom version)#!/bin/bash#author: Tintin (Jacob) #/dev/urandom file is a Linux built-in random device file #cat/dev/urandom can look inside the content, CTRL + C exit View # After viewing the contents of the file,
First paste one, join--helpusage:join [OPTION] ... FILE1 File2for Each pair of the input lines with the identical join fields, write a line tostandard output. thedefault join field is the first, delimitedby whitespace. When FILE1 or FILE2 (not
How to quickly write a startup script , mainly through the following several1, logical smoothing
can be in TXT file, have pseudo code way, form system, List order, then add code in a little bit
Determine if the program is running
#!/bin/bash# Simple script for two number operations A+ -, altogether three parametersEcho$# #对获取的参数以此判断是否包含 [a-za-Z] Something, if included, to exit. Because numbers add up, not numbers, or subtraction. forI_argsinch "[email protected]" Do
Shell scripts become used in the process usually requires process control, in general, sequential execution, in the actual use of different situations need to execute different commands, then use the choice to execute such as if, case, sometimes
Cat ${file} | While Read lineDoecho $ LineDone-------------------------------------------While the read line #每次读取aa a row in the. ListDoEcho $LINE #输出每行的信息Done ${file}-------------------------------------------Reads the first and second columns
This blog post describes the common conditions and looping statements in shell scripts:Conditional statements:650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/06/B7/wKiom1m8ytPDGg7MAAB1t9_5n8Q866.png-wh_500x0-wm_ 3-wmp_4-s_2860871127.png "
Shell shortcut keysTry all the CTRL keys in bash and summarize the following (all keys that appear below are CTRL key combinations):1. U K YU remove the previous characters from the cursor (not included)K Delete the next character of the cursor
In order to simplify the deployment complexity of Tomcat, the previously individually configured script was presented as a parameter that can be used for multi-tomcat instance management in a stand-alone environment.Where the Deploy feature will
The commonly used loops have a for loop and a while loop.
For loop
[email protected] sbin]# cat for.sh#! /bin/bashfor i in ' seq 1 5 '; Do Echo $idoneA sequence in the script that seq 1 5 represents from 1 to 5. You can run this
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.