#!/bin/bash # check if running in terminal? emacs-check exec emacsclient "$@" # failsafe exec nano $*