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

26 lines
494 B
Plaintext
Raw Normal View History

#!/usr/bin/env zsh
2021-07-29 00:37:35 -07:00
# YES_ZSH
2021-09-23 06:48:05 -07:00
# NO_BASH
# NO_DASH
# NO_ASH
2021-07-29 00:37:35 -07:00
2021-07-30 17:57:08 -07:00
cdbusiest() { ### @-
### cd to the directory with the most files in it, counted recursively.
2021-08-01 08:07:55 -07:00
###
### ```
### $ cd
### $ cdbusiest
### 152364 src
### $ pwd
### /home/notwa/src
### ```
2021-07-29 00:37:35 -07:00
dbusiest | read -r c d
[ -z $c ] && return 1
printf "%s\n" "$c $d"
2021-07-29 00:37:35 -07:00
cd $d
}
2021-09-23 06:48:05 -07:00
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
eval ${preload:-preload} dbusiest
[ -n "${preload+-}" ] || cdbusiest "$@"