[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function names starting with %
From: |
Emanuele Torre |
Subject: |
Re: function names starting with % |
Date: |
Tue, 25 Jun 2024 14:32:46 +0200 |
User-agent: |
Mutt/2.2.13 (00d56288) (2024-03-09) |
On Mon, Jun 24, 2024 at 09:37:42PM +0300, 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? Would it be a bad idea to let such functions take
> precedence over jobspecs?
>
> Oğuz
>
There are actually ways to call them:
$ %f(){ echo hi;}
$ compgen -F %f
bash: compgen: warning: -F option may not work as you expect
hi
😎
o/
emanuele6