Vim creates a new shell file, such as my file named Java_run, which reads:
echo "Please enter the Java file path you want to compile:"
Read Path
#分离路径和文件名var1= ' dirname $path ' #路径Var2= ' basename $path ' #文件名CD $var 1Javac $var 2Java ${var2%.*}
When we deploy the project on Linux, we often start the program through a shell, or even call the Java program periodically via the Crontab timer task, but one of the strangest questions is that I wrote a shell script like this:
#!/bin/sh #---------
Using expect to implement automatic interaction of shell scripts
It is very effective for complex interactions and even different processing with different screen output.
And the General Linux, Unix have. It's very easy to use and powerful.
Spawn
Let command introduction:
Let command allows the bash shell to perform arithmetic operations, using lets to compare two operational values or perform operations such as subtraction, which are often used in the process control structure of the shell
Because of the need to use the shell to develop a number of gadgets, when using an array as a function parameter, found that only the first element of the array can be passed, the elements behind the array can not be passed into the function.
Three, Shell script Development Basic Specification
System functions in 1,/etc/init.d/functions action using the method:
Show XXXX, and the right side shows the green OK Word: action "xxxx"/bin/true
Display XXXX, and the right side shows the red
zabbix3.0.4 add monitoring of the process:
method One: Monitor with custom commands
Main idea: Through Ps-ef|grep sdk-push-1.0.0.jar |grep-v grep|wc-l This command to determine whether the process Sdk-push is running, if not equal to 1 means
Shell script is our learning operational difficulties, this content simple example shell script advanced, there are any technical guidance, knowledge of the shortcomings are welcome to point out. Process ControlProgramming languages: Sequential
Debugging Methods for Shell scriptsThe shell provides some options for debugging scripts, as follows:-NRead the command in the script but not execute it to check for syntax errors in the script-VExecutes scripts while printing executed script
1. Architecture 2. Front 2.1 Free QuestionsThe public key confirmation prompt pops up when the server is first connected. Causes an automated task to be interrupted due to the initial connection to the server.The stricthostkeychecking configuration
As with the current development language, there are some grammatical differences!
The
Bourne Shell is a standard UNIX shell that was formerly used as a management system. Most of the system administration command files, such as RC
1. Needs and ideasRequirements: 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, subroutine, configuration
Recently around here for a long time ah, now reluctantly come out, share a little understanding of their ownExit statusA program once run must have only two kinds of results, either success or failure, the result of success is the same, the reason
One: function classification
Local function (local variable)local variable name. modifications to variables in the local function are only valid during the current function run. Func1 () {local Name=test;echo "func1:name= $name"; local
DirectoryI. Condition selection: If statementTwo. Conditional judgment: Case statementThree. For loopI. Condition selection: If statement
Single Branchif judgment condition; thenBranch code with true conditionFiExample: Judging whether a number
#!/bin/bash# Remove site Data web= ' cat website.txt ' if [-Z ' $web '];then #判断长度如果为0 true. No need to test Web site echo "Data that's not tested" exit 1fitest-f result.log && rm-f result.log #test-F if it's a normal file then true Functi On delay {
[-A file] true if the file exists. [-B file] If the file exists and is a special block file, it is true. [-C file] If the file exists and is a special word file, it is true. [-D file] If the file exists and is a directory, it is true. [-E file] If
Uniq
The uniq command can remove duplicate rows from sorted files. Therefore, uniq is often used with sort. That is to say, to make uniq work, all repeated rows must be adjacent.
Uniq syntax
[Root @ WWW ~] # Uniq [-ICU] Option and parameter:-I:
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