[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 21:08 Tue 09 May 2006, Henrik Storner wrote:
> In <sslug@sslug> Jens Bang <sslug@sslug> writes:
> 
> >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?
> 
> for X in ~/EtDir/temp/temp*
> do
>     XNUM=`basename $X | sed -e 's/^temp//'`
>     echo "Tallet er $XNUM"
> done

... og tallet  kan inkrementeres vha:

XNUM=$(( XNUM + 1 ))

echo $XNUM

/Anders



 
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] *