[TUHS] Shell control through external commands

arnold at skeeve.com arnold at skeeve.com
Fri Jul 15 12:25:27 AEST 2016


Dave Horsfall <dave at horsfall.org> wrote:

> On Thu, 14 Jul 2016, shawn wilson wrote:
>
> > I've always been curious though - what was the reason behind 
> > implementing /bin/[ ? IDK any shell where this isn't implemented - I 
> > always assumed it's a POSIX compatibility stopgap older systems needed 
> > to stay compliant with their shipped shell.
>
> To implement:
>
>     [ blah ]
>
> when it wasn't a built-in (there were few built-ins in those days).
>
> I have no idea why it's still there...  A Posix requirement, along with 
> really unsafe functions?

Consider

	execlp("[", "-f", "/some/file", "]", NULL);

Then [ and test need to live in the filesystem.

Arnold



More information about the TUHS mailing list