1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-29 02:17:12 -07:00
rc/sh/cdbusiest

21 lines
386 B
Bash
Executable File

#!/usr/bin/env zsh
# YES_ZSH
cdbusiest() { ### @-
### cd to the directory with the most files in it, counted recursively.
###
### ```
### $ cd
### $ cdbusiest
### 152364 src
### $ pwd
### /home/notwa/src
### ```
dbusiest | read -r c d
[ -z $c ] && return 1
printf "%s\n" "$c $d"
cd $d
}
[ "${SOURCING:-0}" -gt 0 ] || cdbusiest "$@"