1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-13 20:19:03 -08:00
rc/sh/randir

17 lines
363 B
Text
Raw Normal View History

#!/usr/bin/env sh
# YES_ZSH YES_BASH YES_DASH YES_ASH
2021-09-23 06:48:05 -07:00
# works with busybox.
2021-07-29 00:37:35 -07:00
2021-07-30 17:57:08 -07:00
randir() { ### @-
### display a random directory in the current working directory.
###
### ```
### $ randir
### ./sh
### ```
find -maxdepth 1 -type d \( -path '/root' -prune -o -print \) | tail -n+2 | shuf | head -n1
2021-07-29 00:37:35 -07:00
}
[ -n "${preload+-}" ] || randir "$@"