[pacman-dev] [PATCH] Remove use of `seq` in pactree
Dan McGee
dan at archlinux.org
Thu Oct 7 16:52:34 EDT 2010
This is not a bash builtin, so can potentially cause portability issues.
Additionally, the use of it is completely unnecessary as it can all be done
within bash (and done faster).
$ time pactree xfwm4 >/dev/null (old version)
real 0m3.245s
$ time ./contrib/pactree xfwm4 >/dev/null (new version)
real 0m3.042s
Signed-off-by: Dan McGee <dan at archlinux.org>
---
contrib/pactree | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/contrib/pactree b/contrib/pactree
index 73bece3..cb719f3 100755
--- a/contrib/pactree
+++ b/contrib/pactree
@@ -130,9 +130,12 @@ _tree(){
# Generate the spacer
spacer=""
- for each in $(seq 1 $spaces); do
+ local count=0
+ while [[ $count -lt $spaces ]]; do
spacer="$spacer$separator"
+ count=$((count+1))
done
+ unset count
spacer="$spacer$branch_tip"
[ $silent -ne 1 ] && echo -e "$branch_color$spacer$leaf_color$pkg_name$provided"
--
1.7.3.1
More information about the pacman-dev
mailing list