git-shell-commands/ls

25 lines
421 B
Text
Raw Normal View History

2023-09-09 10:38:39 +02:00
#!/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