bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUG: echo call function


From: John McKown
Subject: Re: BUG: echo call function
Date: Wed, 4 Mar 2015 07:31:56 -0600

On Tue, Mar 3, 2015 at 9:17 PM, x Slack x Ruan <xslackx@live.fr> wrote:
> Good evening.
>
> My name is Ruan, was doing some scripting with bash, to launch a script my
> system crashed and restarted.
> When I look at the command syntax.
>
>
>     function example () {
>                            echo `example`
> }
> example

Ah, in my original reply (to list only), it did not occur to me what
you were really trying to do. Are you trying to echo the word
"example"? Because your script uses the grave accent, `, which is a
recursive invocation. Perhaps what you meant do to is:

function example() {
                       echo 'example'
}
example

Notice the use of the '  (Unicode U+0027 character, often called the
apostrophe) instead of the ` (U+0060 or "grave accent"). The U+0060
character invokes the command within it in a subshell and then returns
the stdout of that command to be used in the outer command. In your
case, the command: echo `example`  recursively invokes example within
example without limit, thus causing your problem.

>
>
> The echo generates an infinite loop calling the function without stopping, I
> could see the top command.
> Thousands of bash were being opened, I would report this bug.
>
> One question, I tried to fix myself but I did not really bash the error
> files.
>
> In this case how it could contribute?
>
> Thank U

-- 
He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown



reply via email to

[Prev in Thread] Current Thread [Next in Thread]