I'm working on my first script, and it is to compress all elf executables on a system.
find / * -executable -type f -exec file '{}' \; | grep ELF | sed -e "s/[:].*//" |
upx --best --ultra-brute
upx is not responding to sent files
Not sure if you're going a safe way for your system (don't you want to filter at least shared libs?), but I would suggest:
find / -executable -type f | xargs file |\
grep ELF | cut -d: -f1 | xargs upx --best --ultra-brute
If you have blanks in file names
find / -executable -type f -print0 | xargs -0 file |\
grep ELF | cut -d: -f1 | xargs -0 upx --best --ultra-brute
but is is likely you will bump into a shell limit (xargs: argument line too long)
One workaround would be to use a loop:
find / -executable -type f -print0 | xargs -0 file |\
grep ELF | cut -d: -f1 |\
while read f
do
upx --best --ultra-brute "$f"
done