0
我嘗試使用shell腳本重命名一些沒有任何擴展名的文件。使用文件命令在shell腳本中按類型重命名文件
,比如我有這樣的結果,現在:
[email protected]:~/volume1 $ sh test.sh
01 test2.sh test3.sh test.sh
/home/pi/volume1/test2.sh: Bourne-Again shell script, ASCII text executable
/home/pi/volume1/01/02/**000022223333434444440000**: **gzip** compressed data, last modified: Mon Oct 9 04:17:03 2017, from Unix
,我想在000022223333434444440000.gzip文件
與同爲PDF或ODT文件將是完美的重命名000022223333434444440000文件。
我的劇本是gzip的文件:
#!/bin/bash
PWD=/home/pi/volume1
ls $PWD
var=$(find $PWD -type f -exec file {} \; | grep "gzip")
能否請你幫我學習如何選擇gzip的原始文件與正確的擴展名重命名嗎?
非常感謝。
你確定要文件以點握擴展名重命名?因爲慣例是gzip文件有一個gz擴展名。只是一個快速澄清 –