Permalink
Browse files

Cleanup display

* Use bash arrays to load and iterate over paths safely
  • Loading branch information...
1 parent 117b03f commit b64bd64a7a08d5b17da8e91a448cb4c31e2c419d @bahamas10 committed May 25, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 bin/mad
View
@@ -40,11 +40,13 @@ list_pages() {
#
display() {
- IFS=":"
local page=$1
local paths=".:$MAD_PATH:${0%/*}/../share/mad:/usr/share/mad"
+ # load paths into array
+ local path_array=
+ IFS=: read -a path_array <<< "$paths"
- for path in $paths; do
+ for path in ${path_array[@]}; do
local file=$path/$page
local ext=$path/$page.md
[[ -f "$file" ]] && display_file $file

0 comments on commit b64bd64

Please sign in to comment.