2024-10-11 23:27:07 +03:00
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
text = ''
|
|
|
|
# Picks a random file or directory.
|
|
|
|
function random_file() {
|
|
|
|
local IFS=$'\n'
|
|
|
|
local dirs=($(ls))
|
|
|
|
local total=''${#dirs[@]}
|
|
|
|
((total--))
|
|
|
|
local index=$(shuf -i 0-''${total} -n 1)
|
2024-04-06 03:03:58 +03:00
|
|
|
|
2024-10-11 23:27:07 +03:00
|
|
|
echo ''${dirs[$index]}
|
|
|
|
}
|
|
|
|
'';
|
2024-04-06 03:03:58 +03:00
|
|
|
}
|