LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Scripts run fine on *NIX/csh, but fail on Linux/tcsh? (https://www.linuxquestions.org/questions/programming-9/scripts-run-fine-on-%2Anix-csh-but-fail-on-linux-tcsh-689169/)

b1f30 12-08-2008 03:43 PM

Scripts run fine on *NIX/csh, but fail on Linux/tcsh?
 
All, I'm trying to pick my own brain here with the following:

http://www.mibbit.com/pb/v56XTU

This script runs fine under Solaris/HP-UX/etc using csh, but under Linux/tcsh, I get the following:

: Command not found.

That's: Colon, Command not found.

Please pay careful attention to the 'case' statements which appear to use a lot of colons.

Any idea what's causing the script to bail in Linux?

Any assistance, greatly appreciated.

Cheers.

colucix 12-09-2008 07:58 AM

It is really strange, since the null command (colon) is available both in bash and in tcsh. Can you copy and paste here the exact error message from the terminal? It should tell about the related line number. Also try to add the -vx option in the sha-bang (as suggested in the second line of the script). This should give you a trace of the executed commands, so that you can easily debug the script.

unSpawn 12-09-2008 08:11 AM

Odd. With tcsh-6.14-12.el5 running 'tcsh b1f30.tcsh all' I don't get that error at all?..

Sergei Steshenko 12-09-2008 08:44 AM

Just don't write in tcsh/csh

I once was bitten this way: the scripts I was responsible for (I wasn't the original author) worked just fine in-house, so I had enough confidence to deploy them on customer site.

They failed there, but not always - sometimes. I investigated this - the failure were due to certain tcsh versions.

Of course, in-house the version was different, otherwise I would have caught it. An on customer different machine had different tcsh versions.

Better choose a POSIX-compliant shell, or Perl.


All times are GMT -5. The time now is 04:09 AM.