why does 'which' source my csh?

why does 'which' source my csh?

Post by Shea Marti » Wed, 25 Aug 2004 07:04:16



I use bourne shell, but keep a .cshrc around for time when I need csh.  I use
the company default .cshrc which echo's the date and current working directory
to the terminal.  unfortunately this makes the which command unuseable in scripts.

Is there a way to make which not source the .csh file?

Thanks,

~S

 
 
 

why does 'which' source my csh?

Post by all mail refus » Wed, 25 Aug 2004 07:12:24



> I use bourne shell, but keep a .cshrc around for time when
> I need csh.  I use the company default .cshrc which echo's
> the date and current working directory to the terminal.
> unfortunately this makes the which command unuseable in scripts.
>Is there a way to make which not source the .csh file?

It's a mistake for .cshrc to show stuff like that - put it in .login
instead.   You'll make it hard for people who use csh to use some other
tools such as sftp.  Your company default author should have spotted that.

Do "type" and "whence" not work as well as "which" ?

--
Elvis Notargiacomo  master AT barefaced DOT cheek
http://www.notatla.org.uk/goen/
   If its message contained filing-cabinets in annex, for
   security reasons same sao automatically extinguished.

 
 
 

1. csh: how to 'pre-source' something?'

Is there a way to cause csh to read commands from a file upon invocation,
and then return to reading commands from the terminal, all within the
*same* shell?  In other words, what I would like to do is to exactly
duplicate the .cshrc mechanism, but using another file (after .cshrc)
and cause it to be invoked using some command line mechanism.

What I'm specifically trying to do is to start up a xterm running csh,
but having had certain things done for the user before s/he gets to
start typing.  I can't put this stuff in each user's .cshrc because
I don't know in advance which users will need it, and I can't put it
in /etc/cshrc because only some users will need it, and they only
sometimes.  

What determines whether or not a user needs this setup
is the particular way in which they come in using xwindows -- for
example, I would like to set up a particular command string in MacX,
which would cause a window to pop open for the user, ready to go, with
the necessary setup already done.  I've tried using the -c and -e
options for xterm, but these execute the commands and then terminate
the shell (and window).

I keep thinking there has to be a way to do this, but I can't find it.
Oh, I'm using Irix 4.x on an SGI machine.

Many thanks,

Greg

2. Bind and Postfix

3. why won't scripts work unless i 'source' them?

4. DOSemu parse error

5. Q:sh:Setting env by reading other files - like csh 'source'

6. portability(?): cut

7. Newbie: tcsh/csh 'source' command question

8. info & man pages

9. Why doesn't this work (sh) and what's the (t)csh version?

10. Want bash '&' to behave like csh '&'

11. An extensive comparison of 'sh' and 'csh' language features

12. How to get 'regex()' or 're_exec()''s source?

13. why aren't 'esc' ~ 'break' recognized?