it looks like there are a number of cases in /rc/bin. try "grep -n while".
most of them are argument parsing. but then again, argument parsing
is a large part of what scripts do.
the lack of a break also limits one from doing anything like this:
(snippit from an ancient byron's rc script for calculating the date
n days in the future.)
# figure out what day we have by subtraction
j = (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
c = ()
for (i in 31 $feb 31 30 31 30 31 31 30 31 30 31) {
c = ($c 1)
if ( expr $i '>' $d >/dev/null) {
break
}
d = `{expr $d - $i}
}
perhaps something like
catch(done){
for(i) switch($i){
case -x
xflag = 1;
case -y
yflag = 1;
case *
raise done
}
would be better to implement.
- erik
On Sat Aug 5 18:43:19 CDT 2006, [EMAIL PROTECTED] wrote:
> I think this will work (modified from an rc script of mine):
>
> while (! ~ $#* 0 && ~ $1 -* && ! ~ $1 --) {
> switch ($1) {
> case -a; destsonly=yes
> case -b; copies=($copies $2) ; shift
> case -c; copies=($copies $user)
> case -v; verbose=yes
> case -*
> echo usage: $0 '[-acv] [-b bcc] [file]...' >[1=2]
> exit usage
> }
> shift
> }
> # process $*, which now lacks options ...
>
> I think this is the only situation in which I used to wish for `break'
> in rc, but it no longer seems worthwhile.