diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-02-09 22:51:14 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-02-09 22:51:14 -0500 |
commit | 66c5faa2bce8809a1e7e90eec0542b4de07915df (patch) | |
tree | 36744580a3081f482fe0ee28428f24f664ec5202 /.local/bin/config-path | |
parent | f9232bbdeeb4000d7b89b8a59d591b787266c24b (diff) | |
parent | ca3e04971996ebe2eebf88775e96bbf547aa0abe (diff) |
Merge remote-tracking branch 'origin/master' into build64-par/master
Diffstat (limited to '.local/bin/config-path')
-rwxr-xr-x | .local/bin/config-path | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/.local/bin/config-path b/.local/bin/config-path index 7cd1fcd..1d4d4d1 100755 --- a/.local/bin/config-path +++ b/.local/bin/config-path @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # All the prefixes to consider prefixes=( @@ -61,14 +61,12 @@ main() { done # Finally, print the values - # The `sed` bit here is the only time we call an external program - { - var_done PATH - var_done MANPATH - var_done LD_LIBRARY_PATH - var_done RUBYLIB - var_done PERL5LIB - } | sed 's/^declare \(-\S* \)*//' + lines=() + for var in PATH MANPATH LD_LIBRARY_PATH RUBYLIB PERL5LIB; do + lines+=("$(var_done "$var")") + done + shopt -s extglob + printf -- '%s\n' "${lines[@]##declare *(-+([[:graph:]]) )}" } main "$@" |