Why does my /bin/csh take longer than /bin/perl?

Okay, so I have two "Hello, world!" scripts, "test.pl" and "test.sh".

#!/bin/perl -w
use strict;
print "Hello, world!\n";
#!/bin/csh
echo Hello,\ world!

When I run test.pl, it runs instantly, always. When I run test.sh, it takes anywhere between 4 and 22 seconds!

I'd like to know what could possibly be causing this.

Some facts of interest:

  • I am connected to a remote server via PuTTy (telnet).
  • which csh returns "/bin/csh", which is not a link of any kind.
  • which perl returns "/bin/perl", which is actually a symbolic link to "../perl5/5.8.4/bin/perl".

This is my first time working with csh. Is csh really just that slow?

The same script is a shell that is designed for scripting (i.e., a POSIX shell, such as bash, ash, dash or ksh) takes much less time than csh and quite likely less than perl.

Top Ten Reasons not to use the C shell
Csh problems
Csh Programming Considered Harmful

The exclamation mark might be a problem. Escape it like you did the space.

Also, empty out or trim or optimize or remove /etc/csh.cshrc, /etc/csh.login, $HOME/.cshrc, $HOME/.login, $HOME/.tcshrc, $HOME/.history

Finally, it's possible csh is so under-used that it's never in the OS's file cache or that there's a disk error on the track locating the executable code.

csh is already my default shell. If I'm running csh scripts, are all of those files (/etc/csh.cshrc, /etc/csh.login, $HOME/.cshrc, $HOME/.login, $HOME/.tcshrc, $HOME/.history) still processed? If so, that explains it. The .cshrc file is huge.

How can I make csh skip those files? You see, csh is the default shell at my company, and the .cshrc is necessary because it sets up a lot of environment variables for our software. I can't remove the .cshrc... so can I skip it?