25 lines
479 B
Bash
25 lines
479 B
Bash
|
#!/bin/bash
|
||
|
# -*- mode: sh; tab-width: 8; coding: utf-8-unix -*-
|
||
|
# we use stdout
|
||
|
|
||
|
ROLE=base
|
||
|
prog=$( basename $0 .bash )
|
||
|
|
||
|
N=""
|
||
|
IFS=':'
|
||
|
[ -z "$UID" ] && UID=$( id -u )
|
||
|
for elt in $PATH ; do
|
||
|
[ $UID -eq 0 -a "$elt" = '.' ] && continue
|
||
|
[ -d "$elt" ] || continue
|
||
|
[ -z "$N" ] && N="$elt" && continue
|
||
|
[[ $N =~ (^|:)${elt}(:|$) ]] && continue
|
||
|
N="$N:$elt" && continue
|
||
|
done
|
||
|
IFS=' '
|
||
|
|
||
|
elt=/var/local/bin
|
||
|
[[ "$N" =~ (^|:)"${elt}"(:|$) ]] || N="$N:$elt"
|
||
|
|
||
|
echo $N
|
||
|
exit 0
|