[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?



tir, 09 05 2006 kl. 23:17 +0200, skrev Jens Bang:
> 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?

Nu er jeg ikke den store stjerne til bash, men du kan bruge sed til at
fjerne noget fra din string:
echo "~/EtDir/temp/temp23" | sed 's/~\/EtDir\/temp\/temp//'
Så kan du vel bare skrive
 Y=`echo $X | sed 's/~\/EtDir\/temp\/temp//'`

/Christoffer
> 



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