-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfxxx
More file actions
35 lines (26 loc) · 653 Bytes
/
Copy pathfxxx
File metadata and controls
35 lines (26 loc) · 653 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Display individual directories of colon-delimited variable (e.g. $PATH, etc)
fxxx_func()
{
if [[ -z $1 ]]; then
local nx0=$(basename "$0")
echo "Format: $nx0 varname \"varvalue\" [x]"
echo " E.g. $nx0 PATH \"\$PATH\" [x]"
echo " \$3, if non-blank, suppresses blank line at start"
return
fi
if [[ -z $3 ]]; then echo ""; fi
echo "${1}="
echo ""
if [[ -n $2 ]]; then
while IFS=':' read -ra arDIRS; do
for dir in "${arDIRS[@]}"; do
if [[ -n $dir ]]; then
echo " ${dir}"
fi
done
done <<< "${2}"
echo ""
fi
}
fxxx_func "$1" "$2" "$3"