TemplateCat delbak.sh#!/bin/shlocation= "/root/sqlbak/"Find $location-mtime +30-type f |xargs rm-fPs:Location is the directory where the lookup is set--mtime +30 is set time is 30 days ago-type F this week the type of lookup is fileThen add crontab
The original script check.sh:Monfile= "/var/log/test/testmon.txt"Logfile= "/var/log/test/testmon.log"Touch $monfile...The script is edited in window and uploaded to Linux after editing.Problem:After running, the file that appears in the directory is
#!/bin/bashecho "**********argument**********"Echo Script Name: $Echo First argument $echo second argumentecho num of argument $#echo all argument [email protected]#functionEqual (){Case $ in$)return 0;;*)Return 1;;Esac}#ifecho "**********test if****
Questions1. How random numbers are obtained2. How to determine the size of the random value is what we needAnswers1. Can now be obtained by obtaining the number of milliseconds of the system time, after all, the number of milliseconds changes
1. Change the suffix ". sh" suffix to ". Shell" under the/OPT directory (including subdirectories)2. Renaming files A1, A2, A3 files in directories A, B and C to A4, A5, A63. How to change the AA string in the file to BB in the VI
Middle BracketBrackets are divided into single brackets [], and double brackets [[]], and brackets are commonly used in expression judgments, and parentheses can also be used in expressions, as mentioned later.Single brackets []a=5b=3[$A-eq $B]
1. Know CronCron is a timed execution tool under Linux that can run a job without human intervention. Since Cron is a built-in service for Linux, it does not automatically get up, and you can start and shut down this service in the following
Title: Numerical N accumulates to M (nIn the following example, the examples are 1 to 100, and they can be brought into N and M (nFor loop implementationSum=0for ((i=1;iBy using variable arithmetic to implementEcho $[$ (Echo +{1..100})]echo $ (($
Methods for modifying the path path of environment variables under the CentOS systemThe essential part of the computer's brain is the operating system. And the development of Linux is very rapid, there is a trend to overtake Microsoft. This article
Shell && and | |When the shell executes a command, it returns a return value that is saved in the shell variable $? In When $? = = 0 o'clock, indicating successful execution; = = 1 o'clock, which indicates that the execution failed.Sometimes the
In the Nginx site, access and error are using the default log format, with the log file named as follows:Www.xxxx.com.access.logWww.xxxx.com.error.logThe script processes the previous day's log records, re-places the logs in compressed files, and
How to pass parameters inside the shell:JS Code
SH test.sh Zhang 20
How do you accept parameters in the test.sh?JS Code
#!/usr/bin/env SH
Name=$1
Age=$2
echo "name is ${name} & ${age}"
Output: Name is Yaochun &
# Auther:aaron Fan‘‘‘Ideas:The purpose is to modify yesterday this file, but because it is not possible to directly modify the file, so the modified content needs to be written to the high yesterday.new this file,And then overwrite the contents of
KVM One-click Shell automatically generates a Windows virtual machine, unattended operation scheme is divided into four steps to complete the joint;The first step: Start the startup script, so that the machine can be executed at the start of 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.