I have following pre-commit hook:
#!/bin/bash
set -e
result=''
for file in $(find rest/src/main/groovy/ru/naumen/modules -name '*.groovy' | sort); do
filename=basename "$file"
result+=echo "${filename//.groovy/}",
done
result+='smpUtils'
sed -i -r "s|modules = .*|modules = $result|g" rest/smpsync.ini
git add rest/smpsync.ini
I'm getting Permission denied
error on line 8
filename=basename "$file"
And I'm not able to determine the reason of it.
Hook itself has execution rights (chmod +x .git/hooks/pre-commit
)
Whole directories/files tree in ./rest/src/main/groovy/ru/naumen/modules
has read/write rights and belongs to my user.
filename=basename "$file"
you need a$( )
but also can be done with P.E.filename=${file##*/}