11 lines
167 B
Bash
11 lines
167 B
Bash
# shellcheck shell=sh
|
|
follow_link() {
|
|
FILE="$1"
|
|
while [ -h "$FILE" ]; do
|
|
# On macOS, readlink -f doesn't work.
|
|
FILE="$(readlink "$FILE")"
|
|
done
|
|
echo "$FILE"
|
|
}
|
|
|