我有一些文件的文件名格式如下:<timestamp>-High<variable alphanumeric string>
,例如2016-10-01 11:12:12-Highlaskdja
。
我正在尝试重命名所有这些文件并删除时间戳前缀。我尝试了以下方法,但没有成功
#!/bin/bash
latest=$(ls -dt ~/old/* | head -3) #actually I am removing the 3 most recent files, the error is not here
for file in $latest; do
fileString = "$file"
target = ${fileString%High*}
echo $target #I got error before this line so I have not written any "mv"
done
我该怎么做?谢谢。