Secret command


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Secret command
# 1  
Old 11-07-2008
Secret command

Hi everebody!

Somebody tell me what this command does?
Code:
: ( ) {   : | : &   } ; :

Attention: do not execute this command 'cause your machine crash down!

Thanks a lot.

Last edited by Yogesh Sawant; 05-01-2009 at 05:50 AM.. Reason: added code tags
# 2  
Old 11-07-2008
comand I have tried but give error
Quote:
i have ran that cmd:-

: ( ) { : | : & } ; :
ksh: :: This is not an identifier.

# 3  
Old 11-07-2008
Sorry, I forget to said that I have ran in bash.
# 4  
Old 11-07-2008
:() { something }
is attempting to define a function called ":". Not every shell is going to tolerate a function by that name.

it's a bit interesting that this works:
Code:
$ x() { echo hello & } ; x
hello
[1] 5548
[1] + Done                 echo hello
$
$

I guess the ampersand is doing double duty by backgrounding the command and introducing the start of a command. Usually I would expect:
x() { echo hello & ; }
to be correct. As you can see the end of the command simple invokes the function that was defined.

Where you get into trouble is that the function then invokes itself twice. This winds up trying to run an infinite number of processes. It can't, but it runs as much as it can and will keep this up forever.
# 5  
Old 11-07-2008
The part I don't get is : - it evaluates to "true" in most contexts.
# 6  
Old 11-07-2008
:
is a command that happens to do the equivalent of
exit 0
It is a built-in command so it is very fast. But many built-in commands can be refined with a function definition. In bash, you can define a new version of : if you want.
# 7  
Old 11-07-2008
Thank you everybody for your explanation.
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating a secret code converter

Bashers, thanks for taking the time to look at my post. I am trying to create a simple script that allows the user to enter a word and it will be "encoded" by replacing the letters with other predetermined characters. I am attempting to run one long sed command through a text file that... (15 Replies)
Discussion started by: rgrmatt
15 Replies

2. Web Development

vBulletin: The Secret to Developing vB Plugins

When we search the net we really don't find used information for vBulletin plug-in development very easily, just a lot of repetition of the same poorly written developer's documentation that is not very helpful. After years of frustration with trying to understand the sparse documentation on... (0 Replies)
Discussion started by: Neo
0 Replies

3. Shell Programming and Scripting

Entering secret password

Hello All, I am trying to write a script when executed, asks you for the password, and confirm password; it should save to a file and also entered password should not be in clear text on the console - should be as **** Can somebody give me direction in writing this in shell? Thanks Chiru (4 Replies)
Discussion started by: chiru_h
4 Replies
Login or Register to Ask a Question