This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git status -s | grep '^[MA]' | while read status file; do | |
| # 去除可能存在的引号 | |
| file=$(echo "$file" | sed 's/^"//;s/"$//') | |
| if [[ "$file" == *"source/_posts"* && "$file" == *".md" ]]; then | |
| now=$(date +"%Y-%m-%d %H:%M:%S") | |
| sed -i "s/^updated:.*/updated: \"$now\"/" "$file" | |
| git add "$file" | |
| echo "Updated timestamp for: $file" | |
| fi | |
| done |