Reputation: 1369
In a makefile I want to check if there are any .sh files and chmod them if any.
test -f !/usr/local/bin/myapp/*.sh || chmod 755 /usr/local/bin/myapp/*.sh
This is the output:
chmod: cannot access '/usr/local/bin/myapp/*.sh': No such file or directory
makefile:102: recipe for target 'install' failed
make: *** [install] Error 1
I don't like using chmod -f
as I might miss other errors
Is there a way to handle this?
Upvotes: 0
Views: 212
Reputation: 136435
One way is GNU find
:
find /usr/local/bin/myapp/ -maxdepth 1 -type f -name "*.sh" -exec chmod 755 {} +
Upvotes: 1