The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
YaST no longer works on SLES 10 hassan1 SuSE 2 04-24-2009 10:47 AM
My account no longer works (Lord Jezo) Forum Support Area for Unregistered Users & Account Problems 0 06-24-2008 02:52 PM
Can no longer login. thebigm Forum Support Area for Unregistered Users & Account Problems 0 07-16-2007 01:52 PM
my account is no longer working mhm4 Forum Support Area for Unregistered Users & Account Problems 9 04-11-2007 08:45 PM
NIS no longer twpvw5 HP-UX 8 11-15-2005 11:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-12-2009
acheong87 acheong87 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
Why does my /bin/csh take longer than /bin/perl?

Okay, so I have two "Hello, world!" scripts, "test.pl" and "test.sh".
Code:
#!/bin/perl -w
use strict;
print "Hello, world!\n";
Code:
#!/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?
  #2 (permalink)  
Old 01-12-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by acheong87 View Post
Okay, so I have two "Hello, world!" scripts, "test.pl" and "test.sh".
Code:
#!/bin/perl -w
use strict;
print "Hello, world!\n";
Code:
#!/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!

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
  #3 (permalink)  
Old 01-12-2009
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,884
Quote:
Originally Posted by acheong87 View Post
Code:
#!/bin/csh
echo Hello,\ world!
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.
  #4 (permalink)  
Old 01-12-2009
acheong87 acheong87 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
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?
Sponsored Links
Closed Thread

Bookmarks

Tags
awk, awk trim, trim, trim awk

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0