[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
 

[bash] sætte en variabel i enwhile-løkke



Jeg har følgende stump kode:

    #!/bin/bash

    bar=foo

    find . -type f | while read p ; do
      if /bin/true ; then bar=$p ; fi
    done

    echo $bar

Jeg ville forvente at det ville skrive det sidste filnavn ud, men den
skriver bare "foo". Både min betingelse og 'bar' er noget mere
kompliceret i virkeligheden. 

Der er et eller andet som sætter et scope, kan jeg komme uden om
dette?

-- 
 Peter Makholm     |         Perhaps that late-night surfing is not such a
 sslug@sslug |           waste of time after all: it is just the web
 http://hacking.dk |                                              dreaming
                   |                                    -- Tim Berners-Lee


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

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