Question: ```
selection=

until [ "$selection" = "0" ]; do

  echo ""
  echo "PROGRAM MENU"
  echo "1 - display free disk space"
  echo "2 - display free memory"
  echo ""
  echo "0 - exit program"
  echo ""
  echo -n "Enter selection: "
  read selection
  echo ""
  case $selection in
      1 ) df ;;
      2 ) free ;;
      0 ) exit ;;
      * ) echo "Please enter 1, 2, or 0"
  esac
echo $selection

done

```

If I press 2 it's showing free space and echo is showing 2, but I need echo is "free".

Answer: 
You can't. The selection is used by the case statement to decide what to do. It is not set by the case statement.

You might want to try something like this instead:

```
selection=

until [ "$selection" = "0" ]; do

  cmd=''

  echo ""
  echo "PROGRAM MENU"
  echo "1 - display free disk space"
  echo "2 - display free memory"
  echo ""
  echo "0 - exit program"
  echo ""
  echo -n "Enter selection: "
  read selection
  echo ""

  case "$selection" in
      1) cmd='df' ;;
      2) cmd='free' ;;
      0) cmd='exit' ;;
      *) echo "Please enter 1, 2, or 0"
  esac

  if [ -n "$cmd" ] ; then 
    echo "selection $selection is '$cmd'"
    $cmd
  fi

done

```

Note that it runs the `echo "selection $selection is '$cmd'` before executing `$cmd`, otherwise it will exit before the `echo` when `$selection` is 0.
> 
> if i press 2 its showing free space and echo is showing 2
>  but i need echo is "free"
> 
> 
> 

So, currently `echo $selection` prints `2` for free and you want it to print `free`. In that case, replace:

```
  2 ) free ;;

```

With:

```
  2 ) free; selection=free ;;

```

With the variable `selection` set to the string `free`, this cause the `echo` command to print what you want.

### Alternative

As another option, but *not* an exact replacement, the bash command `select` can be used to accomplish something similar with a much shorter code:

```
PS3="Please enter 1, 2, or 3: "
select selection in "display free disk space" "display free memory" "exit program"
do
  case "$selection" in
      "display free disk space") df ;;
      "display free memory") free; selection=free ;;
      "exit program") exit ;;
  esac
  echo $selection
done

```