mirror of
https://github.com/StackExchange/blackbox.git
synced 2025-12-15 19:13:01 +02:00
Rewrite profile.d-usrblackbox.sh to only use BASH built-ins; retain file size <132 so that it is an "inline" file.
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
# in weird places (front, middle, or both).
|
# in weird places (front, middle, or both).
|
||||||
|
|
||||||
# To run the test:
|
# To run the test:
|
||||||
# bash tools/profile.d-usrblackbox-test.sh | fgrep --color /usr/blackbox/bin
|
# bash tools/profile.d-usrblackbox-test.sh | fgrep --color /usr/blackbox/bin
|
||||||
# sh profile.d-usrblackbox-test.sh | fgrep --color /usr/blackbox/bin
|
# sh tools/profile.d-usrblackbox-test.sh | fgrep --color /usr/blackbox/bin
|
||||||
|
|
||||||
# NOTE: profile.d-usrblackbox.sh is written to be so small that it fits as an "inline" file.
|
# NOTE: profile.d-usrblackbox.sh is written to be so small that it fits as an "inline" file.
|
||||||
# https://lwn.net/Articles/468678/
|
# https://lwn.net/Articles/468678/
|
||||||
@@ -22,7 +22,7 @@ for p in \
|
|||||||
'/usr/blackbox/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' \
|
'/usr/blackbox/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' \
|
||||||
'/usr/local/bin:/bin:/usr/blackbox/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' \
|
'/usr/local/bin:/bin:/usr/blackbox/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' \
|
||||||
'/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/blackbox/bin' \
|
'/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/blackbox/bin' \
|
||||||
'/Apple spaces/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' \
|
'/Apple spaces/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' \
|
||||||
; do
|
; do
|
||||||
|
|
||||||
export PATH="$p"
|
export PATH="$p"
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
x=/usr/blackbox/bin
|
x=/usr/blackbox/bin
|
||||||
if type pathmunge >/dev/null 2>&1;then
|
if type pathmunge>/dev/null 2>&1;then
|
||||||
pathmunge $x
|
pathmunge $x
|
||||||
elif ! grep -sqF :$x:<<<":$PATH:";then
|
else case ":$PATH:" in *:$x:*);;*)PATH="$x:$PATH";;esac;fi
|
||||||
PATH="$x:$PATH"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user