[net.bugs.4bsd] csh and I/O redirection

jjg@security.UUCP (Jeff Glass) (07/03/85)

put these four lines in a file, say cshtest :

	#! /bin/csh -f
	cat << END | ( sh & )
	echo hi there
	END

( the intent is to send some commands to sh to be executed in the background,
without csh printing the job number of the sh. )

now, from csh, enter the command

	source cshtest

and note that you see the message "hi there".
now enter the commands

	chmod +x cshtest
	./cshtest

nothing happens.

removing either the parentheses or the ampersand causes the message to appear,
but not quietly in the background.  I don't understand why it works when
source'd but not when exec'd, either.

/jeff
-- 
  security!jjg@mitre-bedford.ARPA				(MIL)
 {allegra,ihnp4,utzoo,philabs,uw-beaver}!linus!security!jjg	(UUCP)

carl@bdaemon.UUCP (carl) (07/06/85)

> put these four lines in a file, say cshtest :
> 
> 	#! /bin/csh -f
> 	cat << END | ( sh & )
> 	echo hi there
> 	END
> 
> ( the intent is to send some commands to sh to be executed in the background,
> without csh printing the job number of the sh. )

The answer is simple: Use the Bourne Shell.

Carl Brandauer
daemon associates, Inc.
1760 Sunset Boulevard
Boulder, CO 80302
303-442-1731
{allegra|amd|attunix|cbosgd|ucbvax|ut-sally}!nbires!bdaemon!carl