From f38566bd9749a0ac601d202799ae60d468072a06 Mon Sep 17 00:00:00 2001 From: "Alexandre \"kAworu\" Perrin" Date: Mon, 11 Oct 2010 17:00:11 +0200 Subject: [PATCH] avoid using seq in awsetbg, and test for columns count argument of -m option. Signed-off-by: Uli Schlachter --- utils/awsetbg | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/utils/awsetbg b/utils/awsetbg index 0f638636..bc833c37 100755 --- a/utils/awsetbg +++ b/utils/awsetbg @@ -218,14 +218,21 @@ while [ $# -gt 0 ]; do montage=`which montage` if test ! -z "$montage"; then shift - cols="$1"; shift - fns="" - for i in `seq $cols`; do - fns="$fns $1"; - done; - shift - $montage $fns -geometry +0+0 -tile ${cols}x $CONFIG_DIR/montage.png - wallpaper=$CONFIG_DIR/montage.png + if [ $# -eq 0 ]; then + echo "-m option need a columns argument" + exit # no more args + else + cols="$1"; shift + fns="" + i=$cols + while [ $i -gt 0 ]; do + fns="$fns $1" + i=$(($i - 1)) + done + shift + $montage $fns -geometry +0+0 -tile ${cols}x $CONFIG_DIR/montage.png + wallpaper=$CONFIG_DIR/montage.png + fi else shift echo "montage not found. Falling back to single image"