You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
296 B

  1. #!/bin/sh
  2. DEPTH=${1:-4}
  3. set -eu
  4. ls_r() {
  5. local count="$1" base="$2"
  6. local x= d=
  7. shift 2
  8. count=$(($count - 1))
  9. [ $count -gt 0 ] || return
  10. [ ! -e "$base/.git" ] || echo "${base#./}"
  11. for d in "$base"/*; do
  12. if [ -d "$d" ]; then
  13. ls_r $count "$d" &
  14. fi
  15. done
  16. wait
  17. }
  18. ls_r "$DEPTH" .