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 #---------
The two-day project online
I've been busy.
Three days overtime.
But there's still a harvest.
Premise:
When you write the startup script start.sh, cycle to start the change process
While True
Java-jar Xxx.jar
Done
When starting, of
From: http://www.ixdba.net/a/os/linux/2010/0422/35.html
"When reprinted, please indicate the source of the article and the author's information and this statement in the form of a hyperlink"Original link: http://www.ixdba.net/a/os/linux/2010/0422/35
1. Introduction
Use in shell programming to determine parameters within the IF statement–b returns True when file exists and is a block file-C Returns True when file exists and is a character file-D returns True when pathname exists and is a
14.2 reading user input
14.2.1 Variable
In the previous chapter we talked about how to define or cancel variables, which can be set to the current shell's local variables, or environment variables. If your shell script does not need to invoke other
Description gives beads with lengths of 1~n, and beads of length I have a[i], each with an infinite number of beads, asking how many options are used to string the beads into a chain of length n input Multiple sets of use cases, each set of use
When defining a variable, the variable name does not have a dollar sign (required for variables in the $,php language), such as:Your_name= "Runoob.com"Attention There can be no spaces between the variable name and the equals sign, which may not be
The difference between/bin/sh and/bin/bashSH: If there is an error in the previous statement, the command after the error statement does not executeBASH: If there is an error in the previous statement, the following command will also executeThe
CTRL + A//move to the beginningCtrl+e//Move to end of line===========linux System with ============Alt+a//move to the word header where the cursor is locatedAlt+e//move to the end of the word where the cursor isAlt+d//delete cursor at end of
The test command in the shell is used to check if a condition is true, and it can be tested in three aspects of numeric, character, and file.Numerical Test-eq equalsis True-ne Not equal tois True-gt greater thanis True-ge greater than or equal tois
1. As an executable programSave the above code as test.sh and CD to the appropriate directory:+./test. #使脚本具有执行权限./test. #执行脚本 Note, be sure to write ./test.sh, not test.sh, run other binary programs also, the direct write Test.sh,linux
Color output via echo output, need to add-EECHO-E "\033[background color; font Color \033[0m"Background color40 Setting a black background41 Setting the red background42 Setting the green background43 Setting the brown background44 Setting the blue
Add the following code to the ~/.bash_profile, if none of the files can be created by yourself: Java code
VI ~/.bash_profile
#加入
#export ps1=' [[email protected] w]$ '
Uppercase W represents the last path, and lowercase w for
The testing Test command in shell programming can basically be divided into 3 data types, each of which is different. Individuals are more inclined to understand the rules of writing conditional statements, that is, test plus conditional plus
A fragrant chestnut is better than words#!/bin/bashfoo= "Good" # Without spaces bar= "Hello World" # with spaces awk ' BEGIN {print ' $foo ' "; "'" $bar "'"} 'The pest above maintains the usual practice of enclosing the awk code in single
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