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
In a Linux environment, automate installation steps for multiple packages:
1, find the software package, extract the name of the package to establish the decompression path (in order to let us more clearly find our files)
Pkg= ' Find
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
Modifying a row record in an XML file with a shell script
As before, suppose the following XML file:
Web.xml has the following contents:
cookieName
sessionName
Requirements: Now you need to replace the value of cookiename with a shell
1. Install SSH, install Needless to say, always click Next
2. Click SSH Secure Shell Client and click on Quick connect above.
Host: IP address of the connected Linux (on Linux, log on as root, ifconfig view IP address as shown below)
)
User:
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,
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
First step: Use a text editor to create a text file
The first line must include the shell declaration sequence: #!
#!/bin/bash
Add Comment
Comments start with #
Step two: Run the script
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
About SEDSed is an online editor that processes a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer called pattern space, followed by the SED command to process the contents 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,
Os:centos/redhat Seriesand tested properly on CentOS 6.7 and CentOS 7.2#!/bin/bash## auth:daxin# time:2018/07/10## nginx start Nginx Web server# # chkconfig:-90# Description:start, S Tops and reload Nginx Web server##
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
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
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 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