Weird things in csh (and kernel?)

Fai Lau ugfailau at sunybcs.uucp
Sat Feb 27 09:49:24 AEST 1988


In article <1193 at ark.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>Has anyone noticed the following oddities?
>1)
>	% a.out < a.out
>	a.out: Text file busy.
>	%
>
	This is not as bad as this,

	cat file | grep john > file

	There will be nothing withsoever in file "file". UNIX is kinds
strange when you put the same file name at both "ends" of a pipeline or
redirect. Aviod doing it or sooner or later you'll find out some files
you're working on would be strangely deleted against your wish. Speaking
from experience here.

>Why shouldn't a process be able to read its text file?
>2)
>	% cat ~/.cshrc
>	echo echo hello
>	% cp /bin/echo .
>	% ./echo > echo
>	hello: Command not found.
>	% cat echo
>	echo hello
>	hello
>	%
>
	Find the source code echo.c, compile it, put the executable in you
directory, and the problem would go away. The only explanation
I can give for the phenomonen is that for some reason csh wants to
parse .cshrc, and somehow thinks hello is a command. I'm using
tcsh in /usr/local/bin and I got the error message "/bin/tcsh: not
found" until I restarted with csh did I got the behavior you
described.

Fai Lau
SUNY at Buffalo (The Arctic Wonderland)
UU: ..{rutgers,ames}!sunybcs!ugfailau
BI: ugfailau at sunybcs INT: ugfailau at joey.cs.buffalo.EDU



More information about the Comp.unix.questions mailing list