bug-bash
[Top][All Lists]
Advanced

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

Re: function names starting with %


From: Chet Ramey
Subject: Re: function names starting with %
Date: Mon, 1 Jul 2024 09:18:10 -0400
User-agent: Mozilla Thunderbird

On 6/24/24 2:37 PM, Oğuz wrote:
You can do these

$ %f(){ :;}
$ declare -f %f
%f ()
{
     :
}
$ unset -f %f
$ declare -f %f
$ echo $?
1

but not call them

$ %f
bash: fg: %f: no such job
$ '%f'
bash: fg: %f: no such job
$ \%f
bash: fg: %f: no such job

Why is that?

Think of it as a built-in alias that is expanded before functions are
invoked.

Would it be a bad idea to let such functions take
precedence over jobspecs?

At this point? Yes.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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