[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] BASH: expansion af stjerne *



On Thu, 29 Apr 2004, Kristian Nørgaard wrote:

> > Hvis der er 10.000 filer, så brug:
> > ls *.txt 2>/dev/null | while read FILE ; do echo $FILE ; done
> 
> Nu har jeg ikke 10000, men faktisk 2000 filer.
> Vil du forklare hvorfor din metode er mere effektiv?

Fair nok, jeg slap lidt nemt om ved det.

Når du laver en 'for f $(ls -U *.txt)' så vil det give en expansion 
til 2000 filer. Først når den er udpakket, vil for-løkken starte. 
Desuden vil det kræve noget og sån, så for-løkke er måske ikke det 
bedst egnede her. (nogen retter mig nok hvis det er forkert) 

Og så var der den med '-U' (unsorted), men den kan jo bruges både med
for-løkke og med 'while read'.

/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
If you are explaining, you're losing.
				-- JC Watts


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 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] *