How to add a status once a step is complete on the header part of a menu?

Hi Guru's,

i am creating a script that will update menu of either complete or failed.

#!/bin/bash
choice=0

while [ $choice -ne 4 ]
do

echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""
echo "                ###############################################"
echo "                # Choose a script to run from the list below: #"
echo "                #                                             #"
echo "                # 1) List files   ${status}                #"
echo "                # 2) Copy  ${status}                #"
echo "                # 3) run script  ${status}                #"
echo "                #                                             #"
echo "                # 4) QUIT                                     #"
echo "                #                                             #"
echo "                ###############################################"

echo ""
read -p "                Choice: " choice

case "$choice" in
 1 ) ls -ltr
     RET=$?
     status=""

     if [ $RET -gt 0 ]
     then
        status = "COMPLETE"
     else
        status = "FAILED"
     fi
   ;;
 2 ) cp -pv <file> <dest> ;;
 3 ) ./runprog.sh ;;
 4 ) clear; exit 1 ;;
 *) exit;;
esac

clear

done

the output i am looking is that when return value is ZERO, it will display status COMPLETE on the MENU part else FAILED

EXPECTED OUTPUT

###############################################
# Choose a script to run from the list below:                                 #
#                                                                                          #
# 1) Rename script   COMPLETE                                                  #
# 2) Another script  COMPLETE                                                  #
# 3) OneMore script  FAILED                                                      #
#                                                                                          #
# 4) QUIT                                                                              #
#                                                                                          #
###############################################

is this possible?

Cheers,
ME

     if [ $RET -gt 0 ]      then         status = "COMPLETE"      else         status = "FAILED"      fi

Remove the spaces while you are assigning.
The command will return 0 if its has completed successfully and >0 if it failed.So you need to change your test.

Use separate variables to store the status for different options. This will show the same status for all the options.

And what should be the value when its being run for the first time?
Better initialize status with some value.

but the problem is the status value is not reflecting on the Menu side where i want it to be

Run the script with suggested changes and post back the result. I cannot help you unless I know what errors you are getting. Also post the the updated script(with the suggested changes).