Sponsored Content
Full Discussion: Secret command
Top Forums UNIX for Advanced & Expert Users Secret command Post 302255995 by Perderabo on Friday 7th of November 2008 02:20:37 PM
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.
 

3 More Discussions You Might Find Interesting

1. 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

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

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
ECHO(1) 						    BSD General Commands Manual 						   ECHO(1)

NAME
echo -- write arguments to the standard output SYNOPSIS
echo [-n] [string ...] DESCRIPTION
The echo utility writes any specified operands, separated by single blank (' ') characters and followed by a newline (' ') character, to the standard output. The following option is available: -n Do not print the trailing newline character. The end-of-options marker -- is not recognized and written literally. The newline may also be suppressed by appending 'c' to the end of the string, as is done by iBCS2 compatible systems. Note that the -n option as well as the effect of 'c' are implementation-defined in IEEE Std 1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002. For porta- bility, echo should only be used if the first argument does not start with a hyphen ('-') and does not contain any backslashes (''). If this is not sufficient, printf(1) should be used. Most shells provide a builtin echo command which tends to differ from this utility in the treatment of options and backslashes. Consult the builtin(1) manual page. EXIT STATUS
The echo utility exits 0 on success, and >0 if an error occurs. SEE ALSO
builtin(1), csh(1), printf(1), sh(1) STANDARDS
The echo utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002. BSD
November 12, 2010 BSD
All times are GMT -4. The time now is 03:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy