Previously only heard DreamHost support shell, but not specifically used, mainly in the past is not very need, has not uploaded too many things.
Recently because to upload a large number of files, suffering from the speed of optical cable can not
1.if is a single branch statement, using the following format:
if condition; Then
Statement
.....
Fi
2.if ... else is a two-spoke statement, using the following format:
if condition; Then
Statement
....
Else
Statement
....
Fi
3.if ...
For the user to enter the validity of the date test is a very important issue, this example is simple to get the user entered the date, and converted to the appropriate format, but not perfect, why please read the text.
#!/bin/sh #
In Linux if planning time is a hassle,
Use the awk script as follows
BEGIN {fs= ":"; ofs= ":"}
{total_seconds=total_seconds+$3}
total_seconds>=60 {Total_seconds=total_ sconds-60
$2=$2+1
}
{total_minutes=total_minutes+$2
$2=$2+1
This article to introduce you to the very detailed, specific details please see below.
Start the installation modify the/etc/inittab file first:
Id:5:initdefault:
To
Id:3:initdefault:
#vi/etc/inittab
and restart the computer.
The system
Get the number of rows in a single file
File: test1.sh
Number of rows: 20
Method One
Copy Code code as follows:
awk ' {print NR} ' test1.sh|tail-n1
As shown in the figure:
Method Two
Copy Code code as follows:
This shell script is primarily used for initialization of newly installed Linux server systems, including:
Turn off the IPV6 module
Close SELinux
Let vim display color
Set System language encoding
Optimizing System Services
Kernel parameter
First, topsy variables and environment variables
Variables are an essential part of any programming language and are used to hold variables of various types. Scripting languages are mostly weakly typed languages (dynamic languages), which means
There are several ways to bash a shell script, assuming that the file name of the shell script we have written is hello.sh and that the file location is in the/data/shell directory and has execute permissions.Method One: Switch to the directory
Use of the Let command[Email protected] shell]# i=2[[email protected] shell]# let i=i+8[Email protected] shell]# echo $i10[Email protected] shell]# i=i+8[Email protected] shell]# echo $i10+8[Email protected] shell]#It can be seen from the above that
Save a script file under Windows, upload to CentOS with SSH, add permission to execute Nginx prompt without that file or directory.The shell script is placed in the/etc/init.d/directory, and then executes the/etc/init.d/nginx, prompting more of this
An error occurred while executing the script in Ubuntu system "Source command not found in sh shell"This is actually a script that executes in Ubuntu by default with dash, not bashby command#LS -l 'whichsh/bin/sh --dashWe found that the SH used by
##### #shell Script ##########Bash Script BasicsBASH = GNU Bourne-again Shell,bash is a project developed and promoted by the GNU organization.Bash scripts are similar to batching, simply by putting a lot of instructions together and providing loops,
#!/bin/bashecho "Current datetime is:" ' Date 'echo "Hello world!"#使用变量: You can use single or double quotation marksYour_name= "Wang"Echo $your _nameEcho ${your_name}Str= ' Shellstudy 'Echo ${str}#只读变量: Cannot change its valueMyurl=
The main purpose of the script is to practice capturing signals in a Linux bash script, by practicing the use of functions, and by terminating a running program, subsequent processing of files opened by the program, and so on!Scripting Features:Ping
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.