[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] Hvorfor er 0 == 1? SOLVED



On Monday 10 September 2007, Jørgen Heesche wrote:
> Dette script
>
> #/bin/bash
> FileCount=0
> for X in $(ls -d backup* 2> /dev/null)
> do
>      FileCount=$((FileCount+1))
> done
> echo FileCount=$FileCount
>
> virker med 0, 1, 2, .. n directories, det er ikke nødvendigt at pipe til wc

Jeg markerede koden og kopierede den over i en fil kaldet dirtest.sh, som jeg 
gemte i et tomt directory. Jeg skiftede ned i samme directory som filen. Her 
er resultatet:

sslug@sslug:~/backups/test$ chmod u+x dirtest.sh
sslug@sslug:~/backups/test$ ./dirtest.sh
FileCount=0
sslug@sslug:~/backups/test$ mkdir backup0000
sslug@sslug:~/backups/test$ ./dirtest.sh
./dirtest.sh: line 5:  : command not found
FileCount=0
sslug@sslug:~/backups/test$

Så noget går galt, jeg forstår bare ikke hvad. Det er den linie der tæller 
variablen op der fejler, og den har tidligere virket i den form, så nu er jeg 
ægte forvirret.

-- 

        |\     _,,,---,,_       Greetings, Jens
 ZZZzz /,`.-'`'    -.  ;-;;,_
      |,4-  ) )-,_. ,\ (  `'-'  sslug@sslug
     '---''(_/--'  `-'\_)
----------------------------------------------------
I used to be disgusted, now I try to be amused.
                                                      -- Elvis Costello


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-10-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] *