2010-04-22 23:15:23 +04:00
|
|
|
# $Id: modmisc,v 1.5 2010/04/22 19:15:24 sjg Exp $
|
2006-02-27 00:43:00 +03:00
|
|
|
#
|
2006-02-27 01:40:50 +03:00
|
|
|
# miscellaneous modifier tests
|
2006-02-27 00:43:00 +03:00
|
|
|
|
2010-04-22 23:15:23 +04:00
|
|
|
path=:/bin:/usr/bin::/:.:/user/bin:.
|
2006-02-27 00:43:00 +03:00
|
|
|
# strip cwd from path.
|
|
|
|
MOD_NODOT=S/:/ /g:N.:ts:
|
|
|
|
# and decorate, note that $'s need to be doubled. Also note that
|
|
|
|
# the modifier_variable can be used with other modifiers.
|
|
|
|
MOD_NODOTX=S/:/ /g:N.:@d@'$$d'@
|
2006-05-11 19:37:07 +04:00
|
|
|
# another mod - pretend it is more interesting
|
|
|
|
MOD_HOMES=S,/home/,/homes/,
|
|
|
|
MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@
|
|
|
|
MOD_SEP=S,:, ,g
|
2006-02-27 00:43:00 +03:00
|
|
|
|
2006-05-11 19:37:07 +04:00
|
|
|
all: modvar modvarloop
|
2006-02-27 00:43:00 +03:00
|
|
|
|
|
|
|
modvar:
|
|
|
|
@echo "path='${path}'"
|
|
|
|
@echo "path='${path:${MOD_NODOT}}'"
|
|
|
|
@echo "path='${path:S,home,homes,:${MOD_NODOT}}'"
|
|
|
|
@echo "path=${path:${MOD_NODOTX}:ts:}"
|
2006-05-11 19:37:07 +04:00
|
|
|
@echo "path=${path:${MOD_HOMES}:${MOD_NODOTX}:ts:}"
|
|
|
|
|
|
|
|
.for d in ${path:${MOD_SEP}:N.} /usr/xbin
|
|
|
|
path_$d?= ${d:${MOD_OPT}:${MOD_HOMES}}/
|
|
|
|
paths+= ${d:${MOD_OPT}:${MOD_HOMES}}
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
modvarloop:
|
|
|
|
@echo "path_/usr/xbin=${path_/usr/xbin}"
|
|
|
|
@echo "paths=${paths}"
|
|
|
|
@echo "PATHS=${paths:tu}"
|