Subject: Re: misc/23729: Syntax error: "(" unexpected
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 10/08/2006 15:00:05
The following reply was made to PR misc/23729; it has been noted by GNATS.
From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: misc/23729: Syntax error: "(" unexpected
Date: Sun, 8 Oct 2006 16:55:17 +0200
On Sun, 08 Oct 2006, David Holland wrote:
> % sh -c ./hullo
> ./hullo: 1: Syntax error: "(" unexpected
>
> % ksh -c ./hullo
> ./hullo: 1: Syntax error: "(" unexpected
>
> The behavior exhibited by sh and ksh is historic, but hasn't been
> useful since #! was invented, which was a long time ago.
>
> Probably the best thing to do is to remove it.
I agree. I'd like {sh $file} to always interpret $file as a shell
script, and never try to exec it or parse #! lines. And I'd like {sh
-c $file} to check whether file is an alias or builtin command, and if
not then exec it (leaving the kernel to worry about magic numbers and
#! lines). I think POSIX agrees with me, but it's a bit difficult to
follow their description.
--apb (Alan Barrett)