Introduction to Linux and common commands getting started with 5--linux shell programming

Source: Internet
Author: User

Shell script to generate test data
Vim data_create.sh

Rm-rf./data.txt
Touch Data.txt
For ((i=0;i<2000;i++))
Do
Str= ', name ';
Name=${i}${str}${i}

#echo $name
echo $name >> data.txt
Done

echo ' Show TestData '
More Data.txt

chmod u+x data_create.sh
Run the script
Sh-x data_create.sh


Crontab timed Task Execution shell
Crontab-e Modifying the current user
Crontab-l View
Crontab-l-u root/mysql viewing a user's scheduled tasks

Format: Time-sharing week to run the command
First column minute 1-59
Second column hour 0-23 "0 is 24 points"
Third Liege 1-31
The fourth column is month 1-12.
Day of the week 0-6 "0 is Sunday"


* Indicates that the attribute is ignored

* * * * * cd/root/makaidong_com/file && sh-x fordata.sh >> fordata.log 2>&1

&
Shell while loop: within 10 and =55
#!/bin/bash
Sum=0
I=1

while ((I <= 10))
Do
Let "sum+=i"//sum = Sum+i
Let "i + = 1"//i=i+1
Done
echo "Sum= $sum"


Tar
Linux Compression/Decompression
Gzip-r
Gzip-c *.11.txt > filename.gz
How Linux unlocks the retention source file:
Gunzip filename.gz > FileName


Introduction to Linux and common commands getting started with 5--linux shell programming

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.