try x() first
then alias

On Wed, Jun 18, 2025, 7:30 PM Stan Marsh <gaze...@xmission.com> wrote:

> This is a "Doctor, it hurts when I do this" type thing.
>
> The short answer is that alias substitution occurs very early, so when you
> type:
>
>     alias x='this and that'
>     x() { ... }
>
> you are for all practical purposes, typing:
>
>     'this and that'() { ... }
>
> At which point, anything can happen.  I'm not surprised that you can get
> to a seg
> fault if you try hard enough.
>
> Incidentally, I get caught on this from time to time, if I have something
> defined as
> an alias and then decide to change it to a function.  If I forget to do:
> unalias foo
> first, before sourcing the file containing a function definition for foo,
> I get weird,
> unexplainable error messages.
>
> The real lesson here is: Don't use aliases.  You will eventually rue the
> day.
> But they are so seductive - I have lots of them, even though I know the
> "real lesson"
> stated above.  I think if you've come to bash from csh (as I have), it is
> hard to
> resist the temptation.
>
>
> =================================================================================
> Please do not send me replies to my posts on the list.
> I always read the replies via the web archive, so CC'ing to me is
> unnecessary.
>
> Note that they always end up in my Spam file anyway, so it is annoying to
> have to
> periodically clean that out.
>
>

Reply via email to