Spiff up shebang-fixing snippet
This commit is contained in:
parent
7307de30c3
commit
791e0d22f9
13
grpc.spec
13
grpc.spec
@ -672,15 +672,10 @@ find . -type f -name .gitignore -print -delete
|
|||||||
|
|
||||||
echo '===== Fixing shebangs =====' 2>&1
|
echo '===== Fixing shebangs =====' 2>&1
|
||||||
# Find executables with /usr/bin/env shebangs in the examples, and fix them.
|
# Find executables with /usr/bin/env shebangs in the examples, and fix them.
|
||||||
find examples -type f -perm /0111 |
|
find . -type f -perm /0111 -exec gawk \
|
||||||
while read -r fn
|
'/^#!\/usr\/bin\/env[[:blank:]]/ { print FILENAME }; { nextfile }' \
|
||||||
do
|
'{}' '+' |
|
||||||
if head -n 1 "${fn}" | grep -E '^#!/usr/bin/env[[:blank:]]'
|
xargs -r sed -r -i '1{s|^(#!/usr/bin/)env[[:blank:]]+([^[:blank:]]+)|\1\2|}' \
|
||||||
then
|
|
||||||
sed -r -i '1{s|^(#!/usr/bin/)env[[:blank:]]+([^[:blank:]]+)|\1\2|}' \
|
|
||||||
"${fn}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo '===== Fixing line endings =====' 2>&1
|
echo '===== Fixing line endings =====' 2>&1
|
||||||
# Fix some CRNL line endings:
|
# Fix some CRNL line endings:
|
||||||
|
Loading…
Reference in New Issue
Block a user