Redhatlinux Nic binding

Source: Internet
Author: User
Write a shell program to back up the configuration file in the system File :#! /Bin/bash // define the script execution environment # filename: mulubei // define the script file directory i0 // define the variable to be 0 find/-nameconf & gt; file // list found in the root directory...

Write a shell program to back up the configuration file in the system file
Code implementation:
#! /Bin/bash // define the script execution environment
# Filename: mulubei // defines the script file directory
I = 0 // defines that the variable is equal to 0
Find/-name conf> file // list file found in the root directory, assigned to file
If [-d/tmp/conf]; then // checks whether the file exists,
Echo "/tmp/conf already exists." // the output file already exists.
Else // loop statement
Mkdir/tmp/conf // create a directory
Echo "tmp/conf is created." // The file has been created.
Fi // File ended
While read LINE // A loop statement to read and assign values to the LINE variable
Do // do in a loop statement
DIRS = $ LINE; // assign the LINE variable to DIRS.
BACKUP = "/tmp/conf/backuptailpolici2.16.tar.gz" // scheduled variable backup,
Tar-zcvf $ BACKUP $ DIRS // use tar for compression
I = $ ($ I + 1) // Sum of I values of the cyclic variable
Done This article is from the "Happy first" blog

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: 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.