I have a couple of initscripts that print progress messages and I do
not want to be too hasty in eliminating them so I am thinking of
doing the following for now:

...

if [ -r /lib/lsb/init-functions ] ; then
        . /lib/lsb/init-functions
        print_warning_msg() { log_warning_msg "$*" ; }
        print_begin_msg() { log_begin_msg "$*" ; }
        print_progress_msg() { : ; }
        print_end_msg_and_exit() { log_end_msg "$1" ; exit $1 ; }
else
        print_warning_msg() { echo -n "$*" >&2 ; }
        print_begin_msg() { echo -n "$*" ; }
        print_progress_msg() { echo -n " $*" ; }
        print_end_msg_and_exit() { case "$1" in (0) echo "${2}." ;; (*) echo 
"${3}." ;; esac ; exit $1 ; }
fi

...

case "$1" in
  start)
        print_begin_msg "Doing foo..."
        foo
        print_progress_msg "and now bar..."
        bar
        print_end_msg_and_exit "$?" "done" "failed"
        ;;

...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to