Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含许多 i386 和 x64 的 .a 和 .o 库的文件夹 我想查找并删除所有 x64 库?我知道 objdump 可以提供帮助,但我不知道如何使用它(可能使用带有 'find' 或 'sed' 的 bash 脚本)来列出文件并删除它们。
您可以尝试以下脚本(它从与库相同的文件夹中运行)。我建议您先将“rm -f”替换为回显,以检查要删除的文件列表。
#!/bin/bash for f in *; do fileInfo=$(file $f) echo $fileInfo | grep -q "ELF 64-bit" exitCode=$? if [ $exitCode -eq 0 ]; then rm -f "$f" fi done