#!/bin/bash#echo "1.$12.$23.$3"If ["$" = "+"]ThenRes= ' expr $ + $ 'echo ">>the result is: $RES"elif ["$" = "-"]ThenRes= ' expr $-$ 'echo ">>the result is: $RES"
#这里说明下, using "x" instead of "*"
#是因为在命令行输入 *,shell parsing problem,
#* cannot be
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
When you use a shell to write a program, you sometimes have to confront the problem of interaction--unfortunately, the shell can't automatically complete the interaction. If the interactive content is many, it is convenient to apply expect script
Sometimes we need to repeat the previous commands in Bash. You can certainly use the UP ARROW keys to view the commands you've run before, but this article describes some of the better ways, such as!!,!a,!number,!-number,!$,ctrl+r shortcuts. This
Automatic backup of the entire database
Implement a library to back up a file
Implement exclude libraries that do not require backup
Implementing Backup to Compressed files
Implementing a backup file that defines how many days
Linux Shell Basics
Terminal printing
#!/bin/bash#The printf of Linux termnal,Include "echo,printf"#author by woon echo "The shell\`s name is $0"#examples of echo,printf#默认打印。输出换行echo "Hello World!" echo ‘Hello World!‘#echo -n参数接受不换行输出echo -n
The quoting (reference) in the shell can be used to remove the special meaning of a character so that it retains its literal meaning and can be used for a variety of shell Expansion.There are 3 kinds of quoting mechanisms: escape characters, single
scene: In peacetime work, often need to perform some scheduled tasks, and when the timing of the failure to perform tasks need to come to the nail group, using the [nail robot] can easily and quickly help us do this thing.
Simple to use
I. The existence and judgment of documents-D to determine if the file exists and whether it is a directory file (the directory is true)-E to determine if the file exists (exists as true)-F to determine if the file exists and is a normal file (the
Conditional Select if statement 选择执行: 注意:if语句可嵌套 单分支 if 判断条件;then 条件为真的分支代码 fi 双分支 if 判断条件; then 条件为真的分支代码 else条件为假的分支代码 fi 多分支 if 判断条件1; then 条件为真的分支代码 elif 判断条件2; then 条件为真的分支代码 elif 判断条件3; then
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
In shell scripts, there are some common special variable representations that need to be known.Here are some of the frequently used special variable representations:$ Current PIN name$ ... Parameters of the incoming script or function (greater than 1
Different shells have different functions, the shell also decided that the default shell in Linux is/bin/bash, the popular shell has ash, bash, Ksh, CSH, zsh, and so on, different shells have their own characteristics and use.BashThe Shell,bash
1. Method 1[CPP]View PlainCopy
#!/bin/bash
For ((i=1;i
Do
Echo $i
Done
Save As For1.shDirect SH for1.shWill error:The Syntax Error:bad for loop variable workaround code is not a mistake for standard bash, because
Symbol
Meaning
;
Command delimiter
#
configuration file comments; Root user command terminal prompt
~
Home Directory CD ~
-
Previous Path CD-Su-linux Switching user
First, Shell Script Foundation1. First ScriptVim first.shThere are three ways to execute scripts, respectively:./first.sh (need to have executable permissions)SH first.sh . first.sh(or source first.sh)2. Redirects and Pipe breaks1) redirected
2. Correct method1) Use LetVar=1Let "Var+=1"Echo $varThe output is 2, no tragedy this time.Attention:A) I tested let almost support all operators, see an article on the internet said "let does not support + + 、--and comma, (,)", but after I test the
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