bash-scripts

do mundane tasks with bash automation
Log | Files | Refs | README

vic (241B)


      1 #!/usr/bin/env bash
      2 
      3 RED="\e[31m" RESET="\e[0m"
      4 
      5 cmd=$(which "$1" 2>/dev/null)
      6 editor="${EDITOR:-nvim}"
      7 
      8 if [ -z "$cmd" ]; then
      9   printf '\n%b\n' "${RED}Error${RESET}: command not in path or wrong name."
     10 else
     11   "$editor" "$cmd" || exit 0
     12 fi