[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Hvordan finder jeg det næste tal?



On Tue, 9 May 2006 23:17:13 +0200
Jens Bang <sslug@sslug> wrote:

> Lad mig starte med at sige undskyld for min sidste mail. Den skulle
> have været sendt til sslug-teknik. Sorry.
> 
> Jeg har en række directories der ser sådan ud:
> 
> 	~/EtDir/temp/tempXX
> 
> Hvor XX er et fortløbende heltal.
> 
> Er det muligt at skrive et bash-script der finder det næste tal i
> rækken? Mit gæt er at jeg skal bruge noget á la
> 	for X in ~/EtDir/temp/temp*
> 
> Men hvordan får jeg pillet tallet ud af X?
> 

kig på parameter expansion. noget ala:

for X in ~/EtDir/temp/temp*;do
        FILE = `basename $X`;
	XX = =${FILE#temp};
done

bemærk dog at den antager at du får filerne ind i sorteret rækkefølge
hvilket nok ikke er tilfældet. 


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-06-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *