Bash supports a number of operators, including arithmetic operators , relational operators , Boolean operators , string Operators , and file test operators .Native bash does not support simple math operations, which are string operations by default,
Shell's Features~/.bash_history command history to store files, log out after saving.$HISTSIZE the number of command history bars, which allows the ~/.bash_history file to store the number of command bars, by default.!! : Previous command!$: Last
grep (Global search Regular expression (RE) and print out of the line, fully search regular expressions and print out the lines)grep is a powerful text search tool that uses regular expressions to search for text and prints matching lines without
Shell Programming Four musketeers:Sed awk grep findSed can replace, delete, add, pick, and select data rows for specific tasks1.sed If you do not add any parameters, you will not be able to modify the contents of the file. The plus-i parameter is
Requirements:1. Display the current system date and time, and then create the directory/tmp/lstest2. Switch working directory to/tmp/lstest3. Create a directory A1d,b56e,6test4. Create an empty file xy,x2y,7325. list files or directories in the
The function is actually to give a code a name, each time you use this code can directly use the function name to invoke it.First, create a functionThere are two kinds of formats for creating functions:Format 1:function function name {function
1. Clear the contents of the fileCat/dev/null >>/var/log/messages2. The script to determine whether the user is the root userRoot_uid = 0 # $UID is 0 o'clock, the user has root user rightsIf ["$UID"-ne "$ROOT _uid"]Thenecho "This user isn't
Java suspended animation, but the process is still in, you can determine whether the log file changes over time to determine whether Java suspended animationThe shell script is as follows:#!/bin/bash# #通过比较五分钟前后, log file MD5 value is the same, to
Repeating a series of commands while running a script is common, and we need to use loop statements to do this.One, for commandFormat: for variable in list;Loop bodyDoneThe for command iterates through each value in the list and exits the loop after
The type of shell that stands on the user's point of view:Log-in Shell:Log in normally via a terminalSu-usernameSu-l usernameNon-landing shell:SU usernameOpen Command Window under graphics terminalShell scripts that are executed automaticallyBash
1. the server needs to clean the common shared directory of the FTP server 17:30 every week, first check the/var/ftp/pub/directory, and then save the detailed list and current time information of all subdirectories and files to/var/log/ Pubdir.log
The format of logical judgmentscase. Sh#!/bin/Bashread-P"Please input a number:"nm=$[$n%2] Case$minch 1) echo"It is a Jishu '" ;; 0) echo"It is a oushu." ;; *) echo"Not is a Jishu and Oushu."EsacEnter a string of
Monitoring ideas, Architecture introductionRequirements: Use the shell to customize a variety of personalized alarm tools, but the need for unified management, standardized management.Idea: Specify a script package that contains the main program,
Shell script implements Tomcat self-bootWhen a script is run on a machine, it can implement Tomcat self-boot,However, the script was added to the timed task, but the error was reported: Java.lang.UnsupportedClassVersionError.Cause of errorThis is
Create a shell scriptmkdir ShellVim first.sh#!/bin//tmp/"my home is $HOME""This is first Script"Execute shell scripts, two methodsBash first.shMysql.sock Www_slow.log2015-12-31.wangshaojun.root.history-timestamp Pear
MethodsBoth the Processbuilder.start () and the Runtime.exec () methods are used to create an operating system process (to perform command-line operations) and return an instance of the process subclass that is used to control the status of
First write a test script test.sh on the remote server and give the executable permission: chmod +x test.sh#!/bin/bash echo ' test22 ' echo $$ $ is the first parameter passed in the script, and our console prints this parameterTo create a new MAVEN
Linux Machine First installs wmi-1.3.14.tar.bz2TAR-JXVF wmi-1.3.14.tar.bz2CD wmi-1.3.14MakeCP samba/source/bin/wmic/usr/local/bin/Pass parameter information through the file into the script and get the outputWmi.sh ————————————————————#cat/mess/host|
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