1. Find find Pathname-options [-print-exec-ok] & nbsp; Let's take a look at the parameters of the command: The directory path that the pathname Find command is looking for. For example, to represent the current directory,
The code is as follows
Copy Code
basedirforscriptself=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed script is: ${basedirforscriptself}"Orfullpath=$ (CD "$ (dirname" $) "; pwd)echo "full path to currently executed
Monitoring website 80 Ports
Many times we do not know whether the site 80 port is normal, of course, my previous Shell monitoring site status (continued) This article can also monitor the site, here is just to provide you with another way to
First, create test files test.sh
#!/bin/sh
./etc/profile
# Parameters:
# Args[0], data date, date format Yyyy-mm-dd
# Take 30 days before the date
function Get_date_ 30daysbefore ()
{
sec= ' date-d $ +%s '
sec_30daysbefore=$ ((sec-86400*30))
Locate allows users to quickly search the file system for specific files. The approach is to create a database that includes all the file names and paths in the system, and then simply query the database when looking, without actually going into the
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 #
Description
TAC and Rev are not necessarily connected, the only same is that they are "villains". TAC is actually cat's reverse write, cat normal output, the TAC is inverted output, but the last line from the line output, that Rev? Rev is the last
Monitor hardware Health
Shell monitor Cpu,memory,load average, log to log, when load pressure, email notify admin.Principle:1. Get the value of the Cpu,memory,load average2. Determine whether the value exceeds the scope of the customization, for
1. Examples of error methods
A
Var=1+1
Echo $var
The result of the output is 1+1, tragedy, hehe
b
Var=1
var= $var +1
Echo $var
The output result is 1+1, still tragic, hehe
2. The correct method
1) using Let
Var=1
Let "Var+=1"
Echo $var
The output
In the shell command terminal, CTRL + N equals the direction-down direction key, ctrl+p the direction key that corresponds to the direction. in the command terminal through them or the arrow keys can be used to quickly find the history command.
Ext.: http://justcoding.iteye.com/blog/1963463String-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the shell built a series of
First, under the shell, configure the Security dog installation to the default installation path:C:\Program files\safedogserver\safedogguardcenter Find proguarddata.ini download file to local virtual machineThe virtual machine installs the security
Conditional judgment in shell programmingConditionsIf-thenCaseIf-thenSingle conditionif commandThenCommandsFiWhen the command return code is 0 o'clock, the condition is setif.sh#! /bin/Bashif Date Then Echo "command EXEC"fiifdate123 Then
Regularly back up each server's shake data, to the FTP server, pay attention to the active mode and the passive mode difference#!/bin/bash# active FTP is beneficial to server, client iptables shutdown, client needs to execute Passsiveh after
definition of shell and function1. Linux Shell functionsform a set of command sets or statements into an available block, These statement blocks are called functions. 2. composition of Shell functionsFunctions Name: Function names, note that the
A function is the name of a command or a set of commands.
Functions can make the program modular, thus improving efficiency.
The shell stores functions in memory rather than in disk files, so accessing the function is much faster than accessing
1. Function IntroductionFunctional function is a block of statements consisting of several shell commands for code reuse and modular programming.It is similar to the shell program, but it is not a separate process, it cannot run independently, but
In a Linux system, you can use FDISK to partition the hard disk, but to manually execute a lot of commands, it is cumbersome to use, and now remember that a script with Fdisk is automatically executed.1 #make Partition2Ddif=/dev/zero OF=/DEV/MMCBLK1
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