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
On
You need to include pipe in the exec argument. I do that with sh -c:
find / * -executable -type f -exec sh -c 'file '{}' \
| grep -q ELF' \; -print \
| upx --best --ultra-brute
Also I use here -print instead of your construction with sed. It's better because in case you have : in a filename, sed-based solution will not work (even better is -print0 with xargs -0).
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:
If you have blanks in file names
but is is likely you will bump into a shell limit (xargs: argument line too long)
One workaround would be to use a loop: