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 ?
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 ?
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
.