Home > Article > Operation and Maintenance > shell script command example
Rename A.txt in drive D to B.txt
mv D:\\A.txt D:\\B.txt
Delete the A.txt file under the D drive
rm D:\\A.txt
//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!