bug-bash
[Top][All Lists]
Advanced

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

RE: BUG: echo call function


From: x Slack x Ruan
Subject: RE: BUG: echo call function
Date: Wed, 4 Mar 2015 11:42:19 -0300

I understand the use of ''.
But in this case could not be a interrupt call?
So it is no loop, the problem persists even if there is space between the ``.

I performed a test yesterday and got results.



    FUNCNAME="$(declare -F | awk '{print $3}')"
    FUNCECHO="$(declare -f | grep -o "`.*`" | sed 's/[ \t].*$//g' | tr -d "`")"
 
    if [ $FUNCNAME == $FUNCECHO ]; then
       

# Here in the case would enter the search script that performs the function and kill the process
# Then present the error message in bash
       
    fi


Thanks for the feedback.
Sorry for poor English.



> Date: Wed, 4 Mar 2015 07:31:56 -0600
> Subject: Re: BUG: echo call function
> From: john.archie.mckown@gmail.com
> To: xslackx@live.fr
> CC: bug-bash@gnu.org
>
> 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]