help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cope with spaces in an environment variable


From: Greg Wooledge
Subject: Re: cope with spaces in an environment variable
Date: Sun, 18 Jun 2023 23:20:36 -0400

On Mon, Jun 19, 2023 at 12:09:35PM +0900, Masahiro Yamada wrote:
> [2] With POSIX sh
> 
>     #!/bin/sh
> 
>     eval set -- "${CC}"
>     "$@" foo.c
>     "$@" bar.c
>     "$@" baz.c

It would be less painful in the long run just to set your computer
on fire now, and save yourself the long, slow descent into hell.  And
save the rest of the world from attacks initiated using your cracked
systems, if they're Internet-connected.

You mentioned Makefiles previously.  Makefiles are used in software
development, where a developer has absolute control over the names of
files and directories within the project.

In a Makefile, variables contain space-separated words.  The syntax
will simply fail if you try to use filenames with spaces in them.  This
is fine for developers, because no source code project uses filenames
like that.

Attempting to extend this sort of ivory-tower academic language into
a real-world problem space, where end users have files and directories
with spaces in their names, will not work.

Trying to FORCE it to work with eval is going to end tragically.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]