shell script command example

巴扎黑
Release: 2017-07-21 09:17:18
Original
1159 people have browsed it

1. Rename the file

Rename A.txt in drive D to B.txt

mv D:\\A.txt D:\\B.txt

2. Delete the file

Delete the A.txt file under the D drive

rm D:\\A.txt

3. Modify the file content and Save

//Get the content of A.txt in drive D

oldtime=$(cat D:\\A.txt)

//Get the current year, month and day
time=$(date +"%Y%m%d")

Replace the content of the A.txt file under the D drive with the current date and save it to the B.txt file under the D drive

sed s/$oldtime/$time/ D:\\A.txt >D:\\B.txt

This article is an essay record

The above is the detailed content of shell script command example. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!