-4

I check if a command exists in Bourne shell as below:

if [ "$(command -v emacs)" 2>&1 ]; then alias emacs='emacs -nw'; fi

I am aware that tcsh is not the best shell for shell scripting but how do I implement the above scenario in tcshrc ?

1 Answers1

0

I think it's a simple solution:

/usr/bin/which -s emacs && alias emacs emacs -nw

The full path of which is needed because tcsh has own which which search in aliases too. Please note there isn't equal sign in alias.

uzsolt
  • 5,832
  • 2
  • 20
  • 32