rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* avoiding recursion in functions
@ 1991-11-24  1:58 Brendan Kehoe
  1991-11-24  2:17 ` Robert Earl
  0 siblings, 1 reply; 2+ messages in thread
From: Brendan Kehoe @ 1991-11-24  1:58 UTC (permalink / raw)
  To: rc


 I had this defined:

	fn rm { rm -i }

 which is wrong -- it'll constantly call itself & spiral into
 oblivion.  How can I avoid the second rm being interpreted as the
 function, and instead have it run through the path for it?  (I'd like
 to avoid putting the explicit path in there.)

--
Brendan Kehoe, Sun Network Manager                      brendan@cs.widener.edu
Widener University                                                 Chester, PA
``The reference section discusses Calc in complete depth.''...complete depth?
                                                          -- Calc 2.00 manual


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: avoiding recursion in functions
  1991-11-24  1:58 avoiding recursion in functions Brendan Kehoe
@ 1991-11-24  2:17 ` Robert Earl
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Earl @ 1991-11-24  2:17 UTC (permalink / raw)
  To: brendan; +Cc: rc

|  I had this defined:
| 
| 	fn rm { rm -i }
| 
|  which is wrong -- it'll constantly call itself & spiral into
|  oblivion.  How can I avoid the second rm being interpreted as the
|  function, and instead have it run through the path for it?  (I'd like
|  to avoid putting the explicit path in there.)

fn rm { builtin rm -i $* }	# I suppose you did want $* there?  :)

To quote from TFM:

     builtin command [arg ...]
          Executes the command ignoring any  function  definition
          of  the  same  name.   This command is present to allow
          functions with the same names as builtins  to  use  the
          underlying builtin or binary.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1991-11-24  2:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-11-24  1:58 avoiding recursion in functions Brendan Kehoe
1991-11-24  2:17 ` Robert Earl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).