Use shell to convert case sensitivity in linux

Source: Internet
Author: User
In linux, use shell to convert the case-Linux general technology-Linux programming and kernel information. The following is a detailed description. The problem is as follows:

After installing apache, I threw a bunch of web pages into the corresponding folder. You can use the home page if you find that the source file name of the webpage is *. HTM, and the link between webpages is *. htm. I'm dizzy...

There are two solutions. apache redirection will point to *. HTM. I have never done this. So it is like changing the *. HTM file name to *. htm in a speculative way.

The Code is as follows:

1 for file in *. HTM
2 do
3 newfile = 'echo $ file | tr A-Z a-Z'
4 mv $ file $ newfile
5 done

The script language is too concise. Like

Row 3 traverses the current directory to find the qualified. HTM file. The key lies in the 1st sentence. Save the new file name. tr should be used well. I am also from baidu ...... Note that ''is executed and assigned to newfile. 4th rows, rename. Everything is done.

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.