Shell script Programming Basic article--Several special symbols __ programming

Source: Internet
Author: User

* Inverted quotes ' and $ () *
Let's demonstrate a comparison of the output results using the inverted quotes and $ ()


For this result, is because the $ () in $ () has escaped


to get this result because of the two \=\ in the inverted quotation mark, So keep the meaning of itself


in ', \\=\, at this time there are two \, so one is equivalent to escape, so output 1 \
![ Write a picture description here] (https://img-blog.csdn.net/20160809212156291)
![ Here to write a picture description] (https://img-blog.csdn.net/20160809212205562)
From this we can conclude that
1, the inverted quotation mark itself is escaped to, retains the meaning of the qi itself, If we want to play a special meaning in inverted quotes, we have to use 2 to represent them.
So we can simply think of inverted quotes: \ = \
2, "$ ()" There is no need to consider the problem, as we usually use the same: \ = \
digression: Inverted quotation marks are the old usage, "$ ()" is a new use, whether in the learning test, or in the actual work, * * The use of "$ ()" is the recommended * *.
Eval
Adds an eval before executing the command, and the result is that the shell scans it two times before executing the instruction.



wc-l directive to output the number of files in the current directory

crontab
With Crontab you can execute a shell script or a series of Linux commands at a specified time. For example, the system administrator schedules a backup task to run every day. The
crontab command is common in UNIX and unix-based operating systems to set up instructions that are periodically executed. This command reads the instruction from the standard input device and stores it in a "crontab" file for later reading and execution. The word derives from the Greek chronos (χρνο), which is intended to be time. Often, crontab stored instructions are activated by daemons, Crond often run in the background, checking every minute to see if a scheduled job needs to be performed. This type of assignment is commonly referred to as cron jobs.
1, basic operations

# crontab–e

This allows you to open a personal crontab profile in edit mode, and then join this line:

0 0 * * */home/linrui/xxxxxxxx.sh

This will run the specified. sh file in the wee hours of the day.
2. Parameter
The following is the format of the crontab file:

{minute} {Hour} {Day-of-month} {Month} {Day-of-week} {Full-path-to-shell-script}

O minute: Interval is 0–59

O Hour: Interval is 0–23

O Day-of-month: Interval is 0–31

O Month: The interval is 1–12. 1 is January. 12 is December.

o Day-of-week: The interval is range 0–7. Sunday can be 0 or 7.
3. Command options
Crontab–u: Specify user for Crontab job
Crontab–e: Modify the crontab file. If the file does not exist, it is created automatically.

Crontab–l: Displays the crontab file.

Crontab-r: Deletes the crontab file.

Crontab-ir: Remind users before deleting crontab files.
CRONTAB-V lists the status of the current crontab job (some shell does not support-V operations)

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.