delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/02/16/11:00:07

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
Date: Fri, 16 Feb 2001 17:57:59 +0200
Message-Id: <200102161557.RAA32571@linux.>
From: "Ehud Karni" <ehud AT unix DOT simonwiesel DOT co DOT il>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: Problem with basename
CC: klaus DOT berndl AT sdm DOT de, cygwin AT sourceware DOT cygnus DOT com
In-reply-to: <3A8D39BA.4A5EB7CC@yahoo.com> (message from Earnie Boyd on Fri,
16 Feb 2001 09:31:22 -0500)
Organization: Simon & Wiesel Insurance agency
Reply-to: ehud AT unix DOT simonwiesel DOT co DOT il
References: <C9A98ED35114D31197D000805FEA668E027B19BB AT mucexch DOT muc DOT sdm DOT de> <3A8D39BA DOT 4A5EB7CC AT yahoo DOT com>
X-Mailer: Emacs 20.7.1 rmail (send-msg 1.104)
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id LAA11144

On Fri, 16 Feb 2001 09:31:22 -0500, Earnie Boyd <earnie_boyd AT yahoo DOT com> wrote:
> 
> klaus DOT berndl AT sdm DOT de wrote:
> > 
> > i have written the following function:
> > 
> >     function check-el-compile ()
> >     {
> >         for file in $*; do
> >             elcfile=`basename $file .el`.elc
> >             if [ ! -f "$elcfile" ]; then
> >                 missinglist="$missinglist $file"
> >             fi
> >         done
> >         echo "Not compiled Files: $missinglist"
> >         unset el elc missinglist
> >     }
> > 
> > This function checks which of the passed *.el files are not compiled, i.e. the file <basename>.elc
> > does not exist. Example: abc.el is compiled if abc.elc exists in the same directory.
> > 
> > Now the problem: if i pass the *.el files as argument to this function all is working fine.
> > But if i write the functon like follows:
> > 
> >     function check-el-compile ()
> >     {
> >         for file in `ls *.el`; do
> >             # same as above.
> > 
> > then the basename call doesn´t work, i.e. it always returns $file.
> > It seems that the output of ls contains "something" which confuses basename?!
> > 
> Not really.  Do you have any *.el files with whitespace characters or
> any non alphanumeric characters in the filename?
> 
> You could modify your script to have the for loop call the function.  I
> would also not use the work `file' as a variable name.  I would change
> it to `File' or just F to prevent confusion with the executable of the
> same name.
> 

I've just run your script and it worked with both forms. I would suspect
something is wrong with your command (may be you have tab instead of 
space ? within the 2 basename ?). Run diff on the scripts and check it.

Earnie, Your comment on the "file" variable name is good programming
hint in general, but it sure is not the problem here.

Ehud.


-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud AT unix DOT simonwiesel DOT co DOT il

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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