# fun scripts

**URL:** <https://community.unix.com/t/fun-scripts/237801>\
**Category:** What is on Your Mind?\
**Created:** [April 15, 2009, 1:23pm UTC](https://community.unix.com/t/fun-scripts/237801 "2009-04-15T13:23:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamieMurry](https://community.unix.com/letter_avatar/jamiemurry/32/6_22734026db12803ebb3e059622ac3534.png) [@JamieMurry](https://community.unix.com/u/JamieMurry)\
**Post date:** [April 15, 2009, 1:23pm UTC](https://community.unix.com/t/fun-scripts/237801/1 "2009-04-15T13:23:21Z")

</div>

Lets get a list of everyones funny scripts

---

<div class="post-metadata">

**Author:** ![quirkasaurus](https://community.unix.com/user_avatar/community.unix.com/quirkasaurus/32/1325_2.png) [@quirkasaurus](https://community.unix.com/u/quirkasaurus)\
**Post date:** [April 16, 2009, 4:55pm UTC](https://community.unix.com/t/fun-scripts/237801/2 "2009-04-16T16:55:29Z")

</div>

sure, i'll bite. here's my version of an Obfuscated Ksh script:  
Works on Solaris

```nohighlight
_="$(($$\/$$))";$(`[[ "${#@}" \
!= "${_[*]:-)}" ]];`;)&&\exit \
"$((${?%%,}+${_[@]:=%}))"||$(`\
"${_[@]:+:}">|"${@}".~`:)&&$(`\
\sed \-${!:-e} '/^\(\<.*\>\)$/\
,/^\(\<.*\>\)$/{'"${_[*]:?~}"'\
,$s~^\(\<.**\>\)$~|&|~;}' \-e \
'/[:-)]/,/[%-!]/{$,$y?^?#?;}'<\
+("${@:-)}")>>".//${1##/*/}.~"\
;`;)&&$(>&-;:`${-:+};<&-`;$!);\

```

It has at least some error checking and returns the correct status  
if something goes wrong.

Oh. And notice the variety of smiley faces in there.

---

<div class="post-metadata">

**Author:** ![Ikon](https://community.unix.com/user_avatar/community.unix.com/ikon/32/1015_2.png) [@Ikon](https://community.unix.com/u/Ikon)\
**Post date:** [April 16, 2009, 5:07pm UTC](https://community.unix.com/t/fun-scripts/237801/3 "2009-04-16T17:07:09Z")

</div>

This is an old one.

At a job interview this was a script I had to explain.

```nohighlight
:(){ :|:& };:

```

---

<div class="post-metadata">

**Author:** ![quirkasaurus](https://community.unix.com/user_avatar/community.unix.com/quirkasaurus/32/1325_2.png) [@quirkasaurus](https://community.unix.com/u/quirkasaurus)\
**Post date:** [April 17, 2009, 9:57am UTC](https://community.unix.com/t/fun-scripts/237801/4 "2009-04-17T09:57:02Z")

</div>

> [@ikon](#):
>
> This is an old one.
> 
> At a job interview this was a script I had to explain.
> 
> ```plaintext
> :(){ :|:& };:
> 
> ```

During a job interview?! imho -- not a very constructive question...

This thing doesn't parse on my system. But what I'd expect is  
nothing, since usually the null command comments out the rest  
of the line effectively.

Tried it. It doesn't parse on my system in ksh, csh, sh or bash.

Here's one to try on a terminal that supports colors:

```plaintext
perl -e 'for(0..2){&x($_=q^44,37:07* %41,31:20#%-%44,37:06 *% %47,37:20 %-^)};
&x($_=q^44,37:07* %41,31:20#%-^);for(0..2){&x($_=q^%47,37:34 %-%41,31:34#%-^)};
sub x{for(split(/%/)){s/(\d\d),(\d\d):/\033[$1m\033[$2m:/;
s/:(\d\d)(\D*)/$2x$1/e;s/-/\033[0m\n/g;print;}}'

```

---

<div class="post-metadata">

**Author:** ![quirkasaurus](https://community.unix.com/user_avatar/community.unix.com/quirkasaurus/32/1325_2.png) [@quirkasaurus](https://community.unix.com/u/quirkasaurus)\
**Post date:** [April 17, 2009, 10:02am UTC](https://community.unix.com/t/fun-scripts/237801/5 "2009-04-17T10:02:17Z")

</div>

> [@ikon](#):
>
> This is an old one.
> 
> At a job interview this was a script I had to explain.
> 
> ```plaintext
> :(){ :|:& };:
> 
> ```

Oh. Just reading it, I'd say this:

Looks like a function declaration with an invalid name, the colon NOP command.

Then it pipes the output of the NOP command to another NOP command  
and sticks it in the background.

The {} delimit the function declaration.

The ; is the command separator.

And the final : is just a NOP again.

---

<div class="post-metadata">

**Author:** ![quirkasaurus](https://community.unix.com/user_avatar/community.unix.com/quirkasaurus/32/1325_2.png) [@quirkasaurus](https://community.unix.com/u/quirkasaurus)\
**Post date:** [April 17, 2009, 10:36am UTC](https://community.unix.com/t/fun-scripts/237801/6 "2009-04-17T10:36:03Z")

</div>

oh. it does parse if you do this:

```nohighlight
_(){ :|:& };:

```

---

<div class="post-metadata">

**Author:** ![DeepakS](https://community.unix.com/user_avatar/community.unix.com/deepaks/32/425_2.png) [@DeepakS](https://community.unix.com/u/DeepakS)\
**Post date:** [April 17, 2009, 12:14pm UTC](https://community.unix.com/t/fun-scripts/237801/7 "2009-04-17T12:14:50Z")

</div>

> [@ikon](#):
>
> This is an old one.
> 
> At a job interview this was a script I had to explain.
> 
> ```plaintext
> :(){ :|:& };:
> 
> ```

That little guy looks like he'll provide more forks than I have in my kitchen.

---

<div class="post-metadata">

**Author:** ![pludi](https://community.unix.com/user_avatar/community.unix.com/pludi/32/1278_2.png) [@pludi](https://community.unix.com/u/pludi)\
**Post date:** [April 17, 2009, 1:18pm UTC](https://community.unix.com/t/fun-scripts/237801/8 "2009-04-17T13:18:51Z")

</div>

[Link](http://www.unix.com/unix-advanced-expert-users/88536-secret-command.html) for explanation (and it's not really funny IMO)

---

<div class="post-metadata">

**Author:** ![Ikon](https://community.unix.com/user_avatar/community.unix.com/ikon/32/1015_2.png) [@Ikon](https://community.unix.com/u/Ikon)\
**Post date:** [April 17, 2009, 1:22pm UTC](https://community.unix.com/t/fun-scripts/237801/9 "2009-04-17T13:22:15Z")

</div>

Here too:

[Fork bomb - Wikipedia, the free encyclopedia](http://en.wikipedia.org/wiki/Fork_bomb)
