It is currently Fri, 15 Oct 2021 20:12:52 GMT



 
Author Message
 function calls in tcsh

Hi Everyone,

I am having a little trouble with function calls in tcsh.

---- START

#!/usr/bin/tcsh

test() {

statement1;
statement2;

test

---- END

During runtime I receive the following error...

"Badly placed ()'s."

If you anybody can point me to the right direction would be greatly
appreciated.

- Abdul Bahar



 Sun, 17 Jul 2005 23:00:15 GMT   
 function calls in tcsh
In article <Pine.SGI.4.33.0301290857460.17448363-100...@bi11.msi.umn.edu>,
Abdul R. Bahar <baha...@bscl.msi.umn.edu> wrote:

There are no shell functions in csh and tcsh.

The right direction is away from csh and tcsh.

< http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ >
< http://www.grymoire.com/Unix/CshTop10.txt >

Try zsh, ksh, or perhaps bash.

--
G?ran Larsson     http://www.mitt-eget.com



 Sun, 17 Jul 2005 23:14:35 GMT   
 function calls in tcsh

ignore this plz.

i didn't know only bsh supported it



 Mon, 18 Jul 2005 01:56:45 GMT   
 function calls in tcsh

/bin/sh, as well as all /bin/sh-compatible shells (bash, ksh, zsh)
support it.

Vadim.

  application_pgp-signature_part
< 1K Download


 Mon, 18 Jul 2005 02:54:20 GMT   
 function calls in tcsh
In article <Pine.SGI.4.33.0301291156160.17542119-100...@bi11.msi.umn.edu>,
Abdul R. Bahar <baha...@bscl.msi.umn.edu> wrote:

Not just bsh.  Also bash, sh, ksh, and just about every non-csh-derived
shell.

One of the many reasons why csh is a lousy scripting shell.  See
<http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/> for more of them.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



 Mon, 18 Jul 2005 02:26:41 GMT   
 function calls in tcsh
Sorry about the error. I read about it early in the morning. In that
case my wording was incorrect when I used the word "only".

- Rajib



 Mon, 18 Jul 2005 03:48:14 GMT   
 function calls in tcsh
"Abdul R. Bahar" <baha...@bscl.msi.umn.edu> wrote in message <news:Pine.SGI.4.33.0301290857460.17448363-100000@bi11.msi.umn.edu>...

The lack of [t]csh functions is the ultimate irony
given that csh was supposed to be C-like.  It is
missing what is probably one of the most important
features of C!  I personally would not even consider
programming in a language that did have functions
or some similar objects.  Would you?

Do you have files lying around that have "#!/bin/csh"
(or somesuch)as the first line?  You should seriously
consider changing the first line to "#!/bin/ksh"
(or somesuch) then converting the stuff inside those
files to something maintainable/portable and containing
modular implementation (functions).

C shell has been condemned 8 ways from Sunday, but
to me all it took was the glaring absence of functions.
Interactively it may be fine, but who wants to run
a particular shell as command interpreter (csh)
and program modules in a radically different shell
language?  Could this lead to a bad case of pathological
software schizophrenia?

Incidentally, one of my past professional tasks was
to move developers from 'csh' to 'ksh'.  They were
all very happy to say goodbye to 'csh'.  And many
were csh fanatics.  Never saw one that wasn't, come
to think of it.  Otherwise they wouldn't be still
using it.

HTH

Tim



 Mon, 18 Jul 2005 10:11:53 GMT   
 function calls in tcsh

The old Bourne shell didn't have functions either.
We just wrote a separate shell script.

--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.



 Mon, 18 Jul 2005 11:28:35 GMT   
 function calls in tcsh

  Good point!  I  would have done the same
  without functions.  Amounts to augmenting the UNIX
  command set, doesn't it?  But the overhead?!  Probably
  worth it.  Wonder if the [t]csh folks use this trick?
  I haven't looked at that many [t]csh modules ... my
  nausea tolerance is minimal.  I knew early Bourne was
  functionless but never had the displeasure of bumping
  into Bourne that braindead. Wonder when it was Bourne
  got them.

Tim



 Mon, 18 Jul 2005 23:12:02 GMT   
 function calls in tcsh

That's what I did. You also had to do this if you wanted to pipe the
output into a for/while loop - because csh can't use redirection with
control structures. I developed a soft spot on my head for the C shell
- where I bashed it against the wall during moments like this.

I think AT&T Unix System V?

--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.



 Tue, 19 Jul 2005 09:15:01 GMT   
 
   [ 10 post ] 

Similar Threads

1. Browser calls CGI C function which sets an env var and call a c function crashes

2. Main function calling another main function

3. C functions calling C++ functions on Solaris

4. function calls versus function pointers ?

5. Tree of Functions calling Functions etc.

6. Call function within a function

7. Non-__init functions calling __init functions

8. Need utility to trap network function calls (socket calls) and save to log file

9. complete function in tcsh

10. TCSH and functions


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software