From 06cec96159898800ffb095ff6c23ebc60f401887 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 8 Jun 2012 18:24:15 +0200 Subject: [PATCH] Make sure /usr/local/[s]bin is first when using path_helper And only add /usr/local/sbin when other sbin directories are already included in the path_helper generated path. --- sys/profile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/profile b/sys/profile index 7a356c1..8fac5d5 100644 --- a/sys/profile +++ b/sys/profile @@ -28,7 +28,11 @@ unset LC_CTYPE LC_encoding 2>/dev/null # Initialize PATH variable if [ -x /usr/libexec/path_helper ]; then - eval `/usr/libexec/path_helper -s` + eval `/usr/libexec/path_helper -s \ + | sed "s|:/usr/local/bin||" | sed "s|:/usr/local/sbin||"` + [[ "$PATH" == *sbin* ]] \ + && PATH="/usr/local/bin:/usr/local/sbin:$PATH" \ + || PATH="/usr/local/bin:$PATH" else PATH="/usr/local/bin:/usr/bin:/bin" [ "$UID" -eq 0 ] && PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH" -- 2.39.2