On Sun, Nov 17, 2024 at 05:52:26PM +0100, Jeremie Courreges-Anglas wrote:
> On Sun, Nov 17, 2024 at 04:59:34PM +0100, Kirill A. Korinsky wrote:
> > >Synopsis:  ksh: syntax error: `(' unexpected
> > >Category:  ksh
> > >Environment:
> >     System      : OpenBSD 7.6
> >     Details     : OpenBSD 7.6-current (GENERIC.MP) #39: Sun Nov 17 11:27:14 
> > CET 2024
> >                      
> > catap@matebook.local:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > 
> >     Architecture: OpenBSD.amd64
> >     Machine     : amd64
> > >Description:
> >     ksh -n complains as syntax error on legitim shell script.
> > >How-To-Repeat:
> >     echo 'login() { login }' | ksh -n -
> > >Fix:
> >     No idea
> 
> 'login' is already an alias:

But does that matter to the non-interactive ksh shell?  The actual
issue, which you solved in your code below without actually writing
anything about it, is the lack of command-terminator before the final
"}" of reth function definition.

> 
> ritchie ~$ command -v login
> alias login='exec login'
> ritchie ~$ echo '\login() { lala; }' | ksh -n -
> ritchie ~$
> 
> See main.c:
>          /* Aliases that are builtin commands in at&t */
>         "login=exec login",
> 
> I guess a builtin would be slightly cleaner, but it means more code.
> 
> 
> -- 
> jca

-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.

Reply via email to