All gists matching topic command

timmy / 批量顯示 Python 檔案內容

0 Favoriten
0 Forks
1 Dateien
Zuletzt aktiv 10 months ago
這段 Bash 指令使用 find 指令在當前目錄(.)及其子目錄中 搜尋所有 .py(Python)檔案,並對每個找到的檔案執行 顯示檔名並輸出其內容。這適用於 快速查看專案中的 Python 檔案,方便 程式碼審查、備份或檢查腳本內容。
1 #!/bin/bash
2 find . -name "*.py" -exec sh -c 'echo "=== {} ==="; cat "{}"; echo ""' \;
Neuer Älter