Cshell question: taking wordlists as a single string

Andy Clews andy at syma.sussex.ac.uk
Thu Aug 16 23:00:47 AEST 1990


In article <3251 at syma.sussex.ac.uk>, I wrote:
> 
> Basically, then, can Cshell cope with word-lists as single arguments, or
> must I write a C program to do the job (or try sh or ksh?)
>

The solution was staring me in the face and I didn't see it until Jay Plett
sent me this solution:

% xxx "a b c" d e f
a b c
d
e
f
% cat xxx
#! /bin/csh -f

while ( $#argv )
	echo $1
	shift
end



So you must use a while loop rather than a foreach loop. So obvious now
I look at it. *sigh*

Thanks to Jay for the enlightenment.


-- 
Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, England
JANET: andy at syma.sussex.ac.uk   BITNET: andy%syma.sussex.ac.uk at uk.ac



More information about the Comp.unix.questions mailing list