:() { 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:
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.
:
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.
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)
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)
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)