SUMMARY: problem with C shell script

From: Richard Skelton (rich@brake.demon.co.uk)
Date: Fri Aug 08 1997 - 15:45:58 CDT


Hi Managers,

my original problem:-
> Hi Managers
>
> I have a directory containing :-
>
> brake{rich}176: ls
> cal_shares shares0/ shares1/ shares2/ shares3/
>
> if I type in a C shell :-
>
> brake{rich}175: foreach ii ( s* )
> ? cd $ii
> ? pwd
> ? cd ..
> ? pwd
> ? end
> /export/home/rich/shares/shares0
> /export/home/rich/shares
> /export/home/rich/shares/shares1
> /export/home/rich/shares
> /export/home/rich/shares/shares2
> /export/home/rich/shares
> /export/home/rich/shares/shares3
> /export/home/rich/shares
>
>
> The directorys which match are cd as I would expect, but the file cal_shares
:-
>
> #!/bin/csh -f
> foreach ii ( s* )
> cd $ii
> pwd
> cd ..
> end
>
> is run it produces :-
> brake{rich}176: cal_shares
> /export/home/rich/shares
> /export/home/rich/shares/shares0
> /export/home/rich/shares
>
>
> It only sees the first directoy.
> Why is the ii variable not incrementing?
>

The first Solution came form Matt Reynolds:-

> Have you put a carriage return at the end of the script (ie at the
> end of the line with 'end' on it)? If you haven't, it won't find the
> end statement.
>
I did not have a carriage return at the end of the script.
Thanks matt!

Cheers
Richard.
=
Richard Skelton | e-mail : Richard.Skelton@brake.demon.co.uk
                         WWW : http://www.brake.demon.co.uk/



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:00 CDT