#!/bin/bash if [ $# -eq 0 ]; then whiptail --errorbox "Usage:ted file1.txt file2.txt" 8 60 exit 1 fi files_list=$(printf "%s\n" "$@") THEEDITOR=$(whiptail --title "[ted] Editor" \ --ok-button "Edit" \ --cancel-button "Cancel" \ --menu "Choose an editor to edit:\n$files_list" 20 80 8 \ "nano" "" \ "nvim" "" \ "vim" "" \ "vi" "" \ "micro" "" \ "mousepad" " (GUI)" \ "code" " (VSCode, GUI)" \ "codium" " (VSCodium, GUI)" \ "gedit" " (GUI)" \ "edit" " ($(readlink -f /usr/bin/edit))" \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus == 0 ]; then echo -e "\033[0;33m=> $THEEDITOR $*\033[0m" "$THEEDITOR" "$@" fi