delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/06/13:55:56

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <BF35D9C143BCCC4EB63181B67C9320C804DE4F@serv-075.icon-germany.local>
From: Heribert Dahms <heribert_dahms AT icon-scm DOT com>
To: "'Harter, Pete'" <Pete DOT Harter AT itt DOT com>,
"'cygwin AT cygwin DOT com'"
<cygwin AT cygwin DOT com>
Subject: RE: "if" "then" "elif" "fi" "done"
Date: Thu, 6 Sep 2001 19:55:32 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Hi Pete,

I'd use something like (untested):

	cat $pdt/$pcase/$pcase`print %03d $pi`.bdf >> $pdt/$pcase.temp


Bye, Heribert (heribert_dahms AT icon-gmbh DOT de)

> -----Original Message-----
> From:	Harter, Pete [SMTP:Pete DOT Harter AT itt DOT com]
> Sent:	Thursday, September 06, 2001 08:02
> To:	'cygwin AT cygwin DOT com'
> Subject:	"if" "then" "elif" "fi" "done"
> 
> Dear Cygwin:
> 
> I'm using Cygwin on NT, writing a bash script to catenate 241 files
> together.  I can't seem to get the  "elif" "fi" "done" statements to work.
> Using "then" seem to have no effect.
> 
> In particular, "elif","fi","done" all cause syntax errors.  I've done a
> "man
> bash", which tells me that the "fi", "elif", "done", etc. ought to work.
> I
> can't find much on the www.cygwin.com about syntax.
> 
> Here's my commands: 
> 
> #!/bin/bash -x
> pdt="/cygdrive/e/temps"
> pcase="case2"
> #
> cat $pdt/$pcase/$pcase'001'.bdf > $pdt/$pcase.temp
> pi=2
> while [$pi < 241]
> do
>   if [$pi < 10] 
>     cat $pdt/$pcase/$pcase'00'$pi.bdf >> $pdt/$pcase.temp
>   elif 
>     if [$pi < 100] 
>       cat $pdt/$pcase/$pcase'0'$pi.bdf >> $pdt/$pcase.temp
>     elif [$pi >= 100] 
>       cat $pdt/$pcase/$pcase$pi.bdf >> $pdt/$pcase.temp
>     fi
>   fi
>   echo $pi
>   pi=$pi+1
> done
> 
> I revised the commands (by trial & error) to the following, which gives no
> syntax error except that it says "unexpected end of file" after the last
> line:
> 
> #!/bin/bash -x
> pdt="/cygdrive/e/temps"
> pcase="case2"
> #
> cat $pdt/$pcase/$pcase'001'.bdf > $pdt/$pcase.temp
> pi=2
> while [$pi < 241]
> do
>   if [$pi < 10] 
>     cat $pdt/$pcase/$pcase'00'$pi.bdf >> $pdt/$pcase.temp
>   ei 
>     if [$pi < 100] 
>       cat $pdt/$pcase/$pcase'0'$pi.bdf >> $pdt/$pcase.temp
>     ei [$pi >= 100] 
>       cat $pdt/$pcase/$pcase$pi.bdf >> $pdt/$pcase.temp
>     endif
>   endif
>   echo $pi
>   pi=$pi+1
> enddo
> 
> Please help.  Thanks
> 
> Pete Harter
> ITT A/CD Mechanical Analysis
> 219-451-6865
> <mailto:pete DOT harter AT itt DOT com>
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019