Functions on csh

Just want to know whether we have function concept available in csh. Because am trying the below function it showing error. If function concept is not available what is the alternative solution.

code:

#!/usr/bin/csh
great()
{
echo "inside"
}
great

Error:

Badly placed ()'s.

Hi,

as far as I know csh has not function feature its as built-in.

                                     sh   csh  ksh  bash tcsh zsh  rc   es
Job control                          N    Y    Y    Y    Y    Y    N    N
Aliases                              N    Y    Y    Y    Y    Y    N    N
Shell functions                      Y(1) N    Y    Y    N    Y    Y    Y

from more details
UNIX shell differences and how to change your shell (Monthly Posting)

you can use the aliases or own script instead of function.

# alias great 'echo inside' && great
inside

regards
ygemici

The best solution would be to not use CSH.

1 Like