#!/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
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%.*}
Question: How does the shell judge a filename to start with a character ~
Solve:
#var = "cn get the length of me"
#$1:parameter 1 to judge the name of the file
Var=$1
Iscn=false
# ${var:0:2} takes the Var substring from the No. 0 character and
This article refers to the example on the http://www.docin.com/p-56167731.html
1. Statistics of the number of rows of a file can be made with the following command:
Grep-c "" Xxx.txt
Or
Grep-n "" Xxx.txt | Wc-l
___________________________
Ps:
Use
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
Reference: http://www.cnblogs.com/dwdxdy/archive/2012/07/25/2608816.html
Often to the stylistic document for line-by-row processing, in the shell how to obtain each row of data, and then processing the row of data, and finally read the next line of
Question: How does the shell judge a filename to start with a character ~
Solve:
#var = "cn get the length of me"
#$1:parameter 1 to judge the name of the file
Var=$1
Iscn=false
# ${var:0:2} takes the Var substring from the No. 0 character and
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
#!/bin/sh
Echo-n "Welcome to I programming World"
Echo-n "This program is a calculator"
Operator= "+-x/exit"
echo "Please input two digits:"
Read Number1 number2
Select I in $operator
Todo
Case $i in
+)
result=$ (($number 1+ $number 2))
Last time I wrote the shell, I found that VI and VIM are different: Vim is the upgrade version of VI, it is not only compatible with all VI directives, but also some new features in it. Vim is much more useful than VI.
This time the last content,
The first step: Download Tomcat 7.0.27 Click the Open link, this is a no-install compression package, decompression can be used.
The second step: Apply for dynamic domain name, you can go here to register a peanut shell account, registered well
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
This example takes the class C address as an example, if it is a Class A or class B address, the script can be modified slightlyIpaddr= '/usr/sbin/ip a | grep $1 | grep inet | awk ' {print $2} ' netmask= ' echo ${ipaddr} | awk -f '/' ' {print $2
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
When you do Flask Web development under Linux, you begin to fully learn to use the sublime editor.Because of the need to shell execute the command under python run.py runserver , it is necessary to be able to invoke the shell execution of the
1, using the shell to intercept log logs for a period of time can use the SED command to extract the log file:The command is as follows:#sed-n '/1531324800/, $p '/data/log/mosquitto/mosquitto.log >> log.log"1531324800": This is the start timestamp,
Concept:The commands that will be executed are saved sequentially to a text file, which can be run by giving the file an executable permission.The composition of the shell script:1) Script statement: The script declaration indicates which
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.