blob: 3e13f71b46bdf3006e43601747e3d5be148317cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#! /usr/bin/env bash
# file : etc/lowercase-headers
# license : MIT; see accompanying LICENSE file
# Create all-lowercase symlinks for .h headers in <dir> (recursively) that
# contain capital letters in their names.
#
usage="usage: $0 <dir>"
trap "{ exit 1; }" ERR
set -o errtrace # Trap in functions.
function error () { echo "$*" 1>&2; exit 1; }
if [ $# -eq 0 ]; then
error "$usage"
fi
for d in "$@"; do
find "$d" -type f -name '*[[:upper:]]*.h' |
while read f; do
b="$(basename "$f")"
d="$(dirname "$f")"
ln -s "$b" "$d/${b,,}"
done
done
|