How to define funtions in tcsh?

How to define funtions in tcsh?

Post by yan.. » Thu, 07 Oct 1999 04:00:00



hi,
 It seem the tcsh manual of redhat hasnot mentioned
 how to define function, what's the syntax

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

How to define funtions in tcsh?

Post by Barry Margoli » Thu, 07 Oct 1999 04:00:00



> It seem the tcsh manual of redhat hasnot mentioned
> how to define function, what's the syntax

Did you really think that the manual would simply omit all mention of such
a feature if it really existed?  I know that sometimes man pages omit small
features like an option or two, but this would be a major fumble.  The
simple fact is that csh and tcsh don't have functions; the closest thing is
aliases (which are in the man page).

Don't try to use csh or tcsh as a scripting language, you'll just frustrate
yourself.  There's a periodic post that explains all the problems with csh
in this regard.

--

GTE Internetworking, Powered by BBN, Burlington, 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.

 
 
 

How to define funtions in tcsh?

Post by Carsten Luckma » Thu, 07 Oct 1999 04:00:00


Hello!



Quote:> It seem the tcsh manual of redhat hasnot mentioned
> how to define function, what's the syntax

That can't be!  tcsh doesn't have support for user defined functions.
Sorry, but that's the truth.

Bye,
     Carsten

--
Carsten Luckmann
Institut fuer Theoretische Physik
Universitaet Hannover, Deutschland

 
 
 

How to define funtions in tcsh?

Post by Rick Jand » Thu, 07 Oct 1999 04:00:00



> hi,
>  It seem the tcsh manual of redhat hasnot mentioned
>  how to define function, what's the syntax

> Sent via Deja.com http://www.deja.com/
> Before you buy.

tcsh-man:

BUGS:
       Alias substitution is most often used to clumsily simulate
       shell procedures;  shell  procedures  should  be  provided
       rather than aliases. "

Rick

 
 
 

How to define funtions in tcsh?

Post by Christopher J. Matter » Thu, 07 Oct 1999 04:00:00




> # hi,
> #  It seem the tcsh manual of redhat hasnot mentioned
> #  how to define function, what's the syntax
> #
> Could it possibly be because they don't exist?  Try ksh. ;)

I tend to prefer ksh myself, but he'd have to go out and get
it and install it on a Red Hat system.  bash, OTOH, is
probably already installed and is not a bad shell at all.

                       Chris Mattern

 
 
 

How to define funtions in tcsh?

Post by Christopher J. Matter » Fri, 08 Oct 1999 04:00:00






> # > # hi,
> # > #  It seem the tcsh manual of redhat hasnot mentioned
> # > #  how to define function, what's the syntax
> # > #
> #
> # > Could it possibly be because they don't exist?  Try ksh. ;)
> #
> # I tend to prefer ksh myself, but he'd have to go out and get
> # it and install it on a Red Hat system.  bash, OTOH, is
> # probably already installed and is not a bad shell at all.
> He could always get pdksh.  Works very nice. ;)  Lot of people tout
> bash as a ksh replacement when it really isn't.

Correct, it isn't.  Thing is, pdksh isn't either, really.  And he'd
*still* have to go out and install it, which might be a bit involved
for him.  And anyways, if it's for personal use, he can get ksh for
free.  If he has to install something, might as well install the
real thing.

                           Chris Mattern

 
 
 

How to define funtions in tcsh?

Post by Peter Seeba » Fri, 08 Oct 1999 04:00:00




Quote:>Correct, it isn't.  Thing is, pdksh isn't either, really.  And he'd
>*still* have to go out and install it, which might be a bit involved
>for him.  And anyways, if it's for personal use, he can get ksh for
>free.  If he has to install something, might as well install the
>real thing.

Maybe he's not willing to install something that doesn't come with source?

I'm really curious as to what the differences really are.  Frankly, I used
AT&T ksh for several years, then switched to pdksh.  I vaguely remember that
there was one difference that affected me, but it was a bug and it got fixed.

Honestly, I think they're a lot more similar than people give them credit
for; none of my scripts care which one I use.

-s
--

C/Unix wizard, Pro-commerce radical, Spam fighter.  Boycott Spamazon!
Will work for interesting hardware.  http://www.plethora.net/~seebs/
Visit my new ISP <URL:http://www.plethora.net/> --- More Net, Less Spam!

 
 
 

How to define funtions in tcsh?

Post by Ralf Draege » Sat, 09 Oct 1999 04:00:00





> >Correct, it isn't.  Thing is, pdksh isn't either, really.  And he'd
> >*still* have to go out and install it, which might be a bit involved
> >for him.  And anyways, if it's for personal use, he can get ksh for
> >free.  If he has to install something, might as well install the
> >real thing.

> Maybe he's not willing to install something that doesn't come with source?

> I'm really curious as to what the differences really are.  Frankly, I used
> AT&T ksh for several years, then switched to pdksh.  I vaguely remember that
> there was one difference that affected me, but it was a bug and it got fixed.

For example that echo bar | read foo dosnt set foo in the current shell?
Its a design bug and cant be done in pdksh and it drives me nuts.

Quote:> Honestly, I think they're a lot more similar than people give them credit
> for; none of my scripts care which one I use.

PDKSH is nice to work with but I prefer AT&T ksah if Ive the choice.

CU, Ralf.
--

- Intraplan Consult Gmbh     Orleansplatz 5a  81667 Muenchen   +49 89 45911-0 -

UNIX is the answer, but only if you phrase the question very carefully.

 
 
 

1. Compare file modification date using tcsh built-ins

Is there any straightforward way to compare file modification dates
(i.e. which is older/newer) using tcsh built-ins?  I know ksh has the
"file1-nt" file2 and "file1-ot file2" operators for boolean expressions,
but I can't seem to find any relatively simple way of performing the
same comparision in tcsh, other than using sed/awk to extract the two
files' date fields from their "ls -l" listings and attempting to
lexographically compare two strings.

Thanks.
Ben West

Sent via Deja.com http://www.deja.com/
Before you buy.

2. NNTP Problems

3. gcc #define #define #define

4. Help!

5. Define Tcsh Alias with $ Character as Regexp

6. mkisofs error on multi-session CD

7. tcsh: define function-like alias

8. ksh question

9. Information on defining PC keypad keys in tcsh - can anyone help me ??

10. m4: how to define var if another defined

11. #define _POSIX_C_SOURCE and other defines

12. Ifstream - read() funtion

13. funtion of .login vs .cshrc