[comp.unix.questions] Problem with rcp/rsh/rdump

weltyc@nysernic (Christopher A. Welty) (10/08/87)

	We are having an odd problem with the above "remote" commands
that doesn't seem to be very well documented....  Attempting to use
them results in a "Where are you?" error message, followed by a swift
exit from the program involved.  I have been unable to locate this
error in the source (I may very well be looking in the wrong places)
except for biff (where it occurs when biff can't figure out what
terminal you're on)....  We are running BSD 4.3 on a Vax, SUNOS 3.3
and 3.4 and other 4.2 deriviatives and it will not work for any
combination .  If you have any idea, I would greatly appreciate some
light being shed on this.  Please mail to me as I don't read this
group.




Christopher Welty - Asst. Director, RPI CS Labs
weltyc@cs.rpi.edu       ...!rutgers! Dalny ht sic

chris@gargoyle.UChicago.EDU (Chris Johnston) (10/08/87)

In article <441@nysernic> weltyc@nic.nyser.net (Christopher A. Welty) writes:
>
>	We are having an odd problem with the above "remote" commands
>Attempting to use
>them results in a "Where are you?" error message, followed by a swift
>exit from the program involved.  

you have the command 'biff y' in your .cshrc file.  Move it to your
.login file.

Also you should test to see if you are in an interactive shell before
executing parts of your .cshrc file

The follwing is part of my .cshrc file...

set path=(/usr/ucb /bin /usr/bin /usr/hosts /local/bin /etc .)
# 
# Check to see if this is an interactive shell...
if ($?prompt) then
 echo -n 
 set history=50
 set prompt="`whoami`@`hostname | sed 's/\..*//'` ! "
 alias	rn	'rn -S'
endif

cj

kyle@xanth.UUCP (Kyle Jones) (10/09/87)

In <759@gargoyle.UChicago.EDU>, chris@gargoyle.UChicago.EDU writes:
> # 
> # Check to see if this is an interactive shell...
> if ($?prompt) then
>  ...
> endif

An oft missed optimization of this is

if ($?prompt == 0) exit 0

which allows csh to skip parsing the rest of the file.

kyle jones  <kyle@odu.edu>  old dominion university, norfolk, va  usa

richl@penguin.USS.TEK.COM (Rick Lindsley) (10/10/87)

In <759@gargoyle.UChicago.EDU>, chris@gargoyle.UChicago.EDU writes:
> # 
> # Check to see if this is an interactive shell...
> if ($?prompt) then
>  ...
> endif

In article <2696@xanth.UUCP> kyle@xanth.UUCP (Kyle Jones) adds:

> An oft missed optimization of this is
> 
> if ($?prompt == 0) exit 0
> 
> which allows csh to skip parsing the rest of the file.

This may not be such a good idea. Remember the shell is sourcing this
file; telling it to exit may not be what you want at all. Let me present
a worst case scenario. I was having trouble figuring out why a shell script
was not working correctly:

while true
do
    stuff
done

"Stuff" was never getting done. Turns out a combination of two things
were happening. The user's .cshrc had a line in that said

if ($?prompt == 0) exit 1

and /bin/true was

--
#
# id string here
#
exit 0
--

Use your wizardry to see the bug here.

Rick