[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 Tuesday 09 May 2006 23:08, Henrik Storner wrote:
>> for X in ~/EtDir/temp/temp*
>> do
>>     XNUM=`basename $X | sed -e 's/^temp//'`
>>     echo "Tallet er $XNUM"
>> done
>
> Det blev godt nok til
>
> cd ~/pictures/temp/
> for X in temp*

OK, alle filer beynder med "temp"

> do
> Â  XNUM=`basename $X | sed -e 's/^temp//'`

men hvad skal du med basename?

> Men det giver en 'command not found' fejl...

For debug, brug:
set -x

#!/bin/sh
# Ex filnavn temp001.jpeg
set -x
cd ~/pictures/temp/
for X in temp* ; do
        echo "X: ${X}"
        SLUT=${X#temp}
        echo "SLUT: ${SLUT}"
        TAL=${SLUT%.jpeg}
        echo "TAL: ${TAL}"
        T=$(( TAL+1 ))
        NEXT=$(printf "%03d" ${T})
        echo "NEXT: ${NEXT}"
done

/hans


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