git-shell-commands/ls
2023-09-09 11:31:52 +02:00

24 lines
421 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
IFS=$'\n'
cd ~git
source git-shell-commands/util.sh
arguments 0 "$#"
for dir in *.git; do
orig_dir="$dir"
case "$dir" in
.*) continue; ;;
esac
dir_path="$dir"
while [ -L "$dir" ]; do
dir="$(readlink "$dir")"
dir_path="$dir_path -> $dir"
done
if ! [ -e "$dir" ]; then
printf '%s (broken symlink!)\n' "$dir_path"
elif [ -d "$dir" ]; then
printf '%s\n' "$dir_path"
fi
done