Goodbye, world!
C + Unix
Outputs a Shakespeare soliloquy before deleting itself:
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int i,char** a)
{char x[99]="rm ",*s="Uo}`b(y"
"ikveeirgaoRTxkwvh]PHZcMV`UHD\\NQ@M"
"MAFDmR^]On&62@3/;FL:.7A00\"+#/:$(7,}y3!z~"
"s.#{+}~nmkwDWjf~rjfjbmwYeZsUed`gbl\\RiY^\\YG"
"LIRWT^EMOPPH>v&HSHBPE1:3K-=7<F(-&-155>~<0!z8(|5"
"*'#(r{s\"8KKwl'h~$rrqorgkcy_g\\uj]Y`1o{zlA[iNRMqd"
"poaVP^RJBAKdWcbTs\"BP>?A3fJ,8-F)?C%A5-%$.;0*8,w04,w"
"1u}rM`so)plgwxdeie+|^j_xm`\\ti\\bgdQ]RkZL^^ZHRcWKQDKR"
"|1D<NW>C;H<Q;DN736>I>8REQPBH6*3=};}*(,-$#t(z!}NQq#y~|s!"
"%xr\"ce}ufoc!]&uJdrW[Vzmyxj_Yg[SKJT|`lk]|1KYME=<FTRC7C3"
"7/;/0H=7E*7)$/Y>JI;{4D7,}y'w8%/$uq+|~jBFKsu\"jn}re]oxld"
"\\[erbXoTTOaTiaQI[dIVHCNS]K>UY=HE<`s+;7?NF3K4,@.F:.:*).&"
"$=-#\"9.!!*4\"#%&pz-ozsu4GSzww\"hiuc{qnxiYliZ.qfYUaSr_i^"
"QMeXJWSGDT}2E=OXF9B;HR63=1<7AEI9/F:5C020(>+'#!TX]')4,z\""
"0(}$xo*kmhx%xkg!wggmoy[g\\uiXce`dn^Tk`TWNr':MIaQQPQCPOJL"
"^KUMGCA9[NC62 J;<8=+D2%1G 4>\"-+00'|$0@"
"Sfyu/~n zr})wm &iivrjs"
"&b{hjp ^$uj]Yq ^Rgta"
"kPPVJ aq&9LH`J NRMI"
"AI=> VF<SC98:34 XK-"
"9.G </+C7373.2\\o $z."
"7(v *|w!&/{r ~t~)wm&y lh\""
"vnvmo pcswlXaZg} 2HXT\\kTP hQQTYJPI`"
"NIFFQZCCLVHK>9GGDN</81 i!2</D&B%#3%=~,~&#'U5-"
"{#1)~%yp+~qmzk%jdtee kq{^`[k$7JdrZdf^clNZ"
"Oh\\_LGYbXPEEQ\\>Z R?:JPTA=97[noCAJ?2"
"*<E :-)A&3%~\" ;+!8,'$y) zz~"
"v.nr!o{( kkfxk.!-"
",|=Pc_wmeZ^gVagUasQjNY"
"^V[X^naHSOL\\TDJM>V9E"
"JFAp} ?MB?-A/54,8C6(662-1G:FE 7(,0/"
"~v%/$uq+# rts2EEqf!m`iboyolviW i\\XdoRTO_"
"j_RX[LdNPOU_WD \\E=Q?w,?7CR9>JNC"
"=K;?2.::D9,$6?7$<(* *17&v+zz'0~tLL_r~{'"
"itrvejemabz_i^ kucV_XpT_fO_P^hX"
"Ne[XbDNMy}}K@ YNAMJTI<8P?1C7"
"C1I2>-E5+B5'4/+31%*(W_*4({"
"t{{wrp+y0my&|mwj!tgc"
"{l\\f^vZWhhqaWncV\\aR"
"R]#''SHaGOTDPMN DM>KUE;R:D61CL="
"5?-1F(4)B01.%-2G Zp#-~5*{{&0#stm}n5("
"{njmu\"duqpbjomwllhcrTi ciy..ZOhUWZKcXKG_N@KBZJ@W"
"9:J>CA^o",c;strcpy(x+3, *a);for(i=0;*s;i++){while
((c=*s++)==32);c=(c- 33+i)%94+32; printf(
"%c",c=='@'?(sleep( 3),'\n'):c);}printf
("\n");system (x);sleep
(6);return c-c;}
I thought I'd better add a description for the benefit of anyone who's having second thoughts about running this program (can't say I blame you :-D). It consists almost entirely of a single text string
*s="Uo}`b(yikveeirgaoRT ... G_N@KBZJ@W9:J>CA^o"; /* 1459 bytes */
which is decoded in a for()
loop with an incrementing counter i
. After
stepping past any white space (while ((c=*s++)==32);
), the program retrieves the original character (c=(c-33+i)%94+32;
) and sends it to stdout, unless it encounters a "@" character, in which case it starts a new line and pauses for 3 seconds:
printf("%c",c=='@'?(sleep(3),'\n'):c);
On exiting the loop, the program deletes itself by making a system call with a string obtained by concatenating the delete command rm
with the name of the program (pointed to by the second argument to the main()
function):
int main(int i,char** a) {
char x[99]="rm " ...
:
strcpy(x+3,*a);
:
system(x);
The decoded text is from Hamlet.
Bash
You don't need a program. Just this shebang at the top of your file:
#!/bin/rm
Then you can put whatever you want in the file, including code that does something interesting, code that doesn't compile, code in a language that doesn't exist, or text in a natural language. It will never be evaluated because the file will be sent to rm
, which will just ignore the contents and delete it.
Commodore 64 BASIC
10 NEW
:) :)