一個批量修改帶有相同檔案名字尾的Shell腳本
#!/bin/bash
#---------------------------------------------------------
#This script is used to change names of station daily data
#---------------------------------------------------------
#begin
cd ./station_data #進入存檔案的目錄
for i in `ls *Expires*` #循環讀入帶有同樣字尾的檔案名
do
mv -i `echo $i ${i%_Expires*}` #去掉第一個“_Expires”及其右邊的字元
done
#end
附:Shell中的${}、##和%使用範例