Date: Sat, 28 Sep 2024 10:33:55 +0200 From: <tlaro...@kergis.com> Message-ID: <zve_cyjtmzaq4...@kergis.com>
| This does mean that one user setting a PATH with variables: | | PATH="/bin:/usr/bin:$MYSCRIPTS:/usr/pkg/bin" | | if MYSCRIPTS is not defined, will end up including the current working | dir in his PATH, while it was not the intention. Yes. The expansion happens before the value is assigned to the variable. There is no difference between that and explicitly including :: | The general rule of safety is doing: | PATH="/bin:/usr/bin:${MYSCRIPTS:-/not/existing}:/usr/pkg/bin" You could, but that would be wasteful. Better would be: PATH="/bin:/usr/bin:${MYSCRIPTS:+${MYSCRIPTS}:}/usr/pkg/bin" or PATH="/bin:/usr/bin${MYSCRIPTS:+:${MYSCRIPTS}}:/usr/pkg/bin" whichever you prefer (they are essentially the same thing). Why stick an entry in PATH that you intend not to be used? kre