diff options
author | Dan McGee <dan@archlinux.org> | 2007-11-30 09:17:15 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-02-14 19:33:33 -0600 |
commit | 980791fd888b6efff6319c77363aab473166ca6b (patch) | |
tree | 76df79af04e221b51729afc9f0d40debb77f2e4d /functions | |
parent | dc4cee8f5987098a07a8b272573424b599a52598 (diff) |
Make functions sh compatible
There is no reason to use bashisms in functions, so eliminate any and use
printf instead of echo options which are not guaranteed to be implemented in
a POSIX sh.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'functions')
-rw-r--r-- | functions | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -16,7 +16,7 @@ elif [ ! -t 1 ]; then USECOLOR="" fi # we use 13 characters for our own stuff -STAT_COL=$[$STAT_COL - 13] +STAT_COL=$(($STAT_COL - 13)) # disable colors on broken terminals TERM_COLORS="$(tput colors 2>/dev/null)" @@ -67,44 +67,44 @@ PREFIX_HL=" >" # functions: deltext() { - echo -ne "$DEL_TEXT" + printf "${DEL_TEXT}" } printhl() { - echo -e "$C_OTHER$PREFIX_HL $C_H1$1$C_CLEAR " + printf "${C_OTHER}${PREFIX_HL} ${C_H1}${1}${C_CLEAR} \n" } printsep() { - echo -e "\n$C_SEPARATOR ------------------------------\n" + printf "\n${C_SEPARATOR} ------------------------------\n" } stat_bkgd() { - echo -ne "$C_OTHER$PREFIX_REG $C_MAIN$1$C_CLEAR " + printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} " deltext - echo -ne " $C_OTHER[${C_BKGD}BKGD$C_OTHER]$C_CLEAR " + printf " ${C_OTHER}[${C_BKGD}BKGD${C_OTHER}]${C_CLEAR} " } stat_busy() { - echo -ne "$C_OTHER$PREFIX_REG $C_MAIN$1$C_CLEAR " - echo -ne "${SAVE_POSITION}" + printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} " + printf "${SAVE_POSITION}" deltext - echo -ne " $C_OTHER[${C_BUSY}BUSY$C_OTHER]$C_CLEAR " + printf " ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} " } stat_append() { - echo -ne "${RESTORE_POSITION}" - echo -ne "$C_MAIN$1$C_CLEAR" - echo -ne "${SAVE_POSITION}" + printf "${RESTORE_POSITION}" + printf "${C_MAIN}${1}${C_CLEAR}" + printf "${SAVE_POSITION}" } stat_done() { deltext - echo -e " $C_OTHER[${C_DONE}DONE$C_OTHER]$C_CLEAR " + printf " ${C_OTHER}[${C_DONE}DONE${C_OTHER}]${C_CLEAR} \n" } stat_fail() { deltext - echo -e " $C_OTHER[${C_FAIL}FAIL$C_OTHER]$C_CLEAR " + printf " ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n" } stat_die() { |