#!/bin/bash
for cmd in nano vi links; do
  command -v "$cmd" >/dev/null 2>&1 || { echo "$cmd is not installed"; exit 1; }
done
echo "1) nano"
echo "2) vi"
echo "3) links"
echo "4) exit"
read -r -p "choose 1-4: " choice
case "$choice" in
  1) exec nano ;;
  2) exec vi ;;
  3) exec links ;;
  4) exit 0 ;;
  *) echo "invalid choice" ; exit 1 ;;
esac

