#!/bin/sh ######################################################################### # # FILE : gettabs # DATE : 26.01.2001 # AUTHOR : Patrick Meier / patrick.meier@gmx.net # DESCRIPTION : create a string with a given number of tabs # # Copyrigth (C) 2001 by Patrick Meier, Switzerland # ######################################################################### PN=`basename "$0"` ######################################################################### # Usage ######################################################################### Usage() { echo "$PN - create a string with a given number of spaces" echo "usage: $PN [number]" exit 1 } ######################################################################### # main ######################################################################### while [ $# -gt 0 ] do case "$1" in --help) Usage;; -h) Usage;break;; *) spaces="$@"; break;; esac shift done num=0 if [ -n "$spaces" ] then if ( `expr $spaces + 1 >/dev/null 2>&1` ) then spaces=`expr $spaces - 1` while [ $num -le $spaces ] do spaceString="$spaceString " num=`expr $num + 1` done echo "$spaceString" fi else echo "ERROR: No argument" Usage exit 1 fi ######################################################################### # EOF #########################################################################