X-Git-Url: http://git.tuebingen.mpg.de/?p=gsu.git;a=blobdiff_plain;f=common;h=eaa5751b43a9133fba3e497b5d45babe1e46b0e9;hp=bd8276b2a96954eef6ef05dfe4cbad5ccf2c1a62;hb=ed9be5dbf52b45497838034033e210ce984c17a6;hpb=f31cc416b1acdbb8f5703b208d943ce500a5b840 diff --git a/common b/common index bd8276b..eaa5751 100644 --- a/common +++ b/common @@ -35,7 +35,7 @@ EOF gsu_is_a_number() { result="$1" - if test "$1" -eq "$1" &> /dev/null; then + if (("$1" == "$1")) &> /dev/null; then ret=$GSU_SUCCESS else ret=-$E_GSU_NOT_A_NUMBER @@ -49,12 +49,12 @@ gsu_short_msg() gsu_msg() { - gsu_short_msg "$_gsu_self: $1" + gsu_short_msg "$gsu_name: $1" } gsu_date_msg() { - gsu_short_msg "$_gsu_self $(date): $1" + gsu_short_msg "$gsu_name $(date): $1" } gsu_err_msg() @@ -62,11 +62,11 @@ gsu_err_msg() local txt="$result" err gsu_is_a_number "$ret" - if test $ret -lt 0; then + if (($ret < 0)); then gsu_msg "unknown error ($ret:$txt)" exit 1 fi - if test $result -ge 0; then + if (($result >= 0)); then gsu_msg "unknown error ($result:$txt)" exit 1 fi @@ -81,8 +81,7 @@ gsu_err_msg() _gsu_setup() { - _gsu_self="$(basename $0)" - gsu_name="${gsu_name:=$_gsu_self}" + gsu_name="${gsu_name:-${0##*/}}" gsu_config_var_prefix="${gsu_config_var_prefix:=$gsu_name}" gsu_banner_txt="${gsu_banner_txt:-set \$gsu_banner_txt to customize this message}" _gsu_init_errors