On Thu, 2003-03-27 at 18:00, Silviu Marin-Caea wrote: > > Aia zice, UNKN. Intre timp, incerc alta chestie, si mi-am prins > urechile in bash. > > LINE=1 > free -b | \ > while read K1 K2 K3 K4 K5 K6 K7 ; do > case "$LINE" in > 2) FREE=$K4 ; BUFFERS=$K6 ; CACHED=$K7 ;; > 3) APPS=$K3 ;; > 4) SWAPUSED=$K3 ; SWAPFREE=$K4 ;; > esac > LINE=$(($LINE+1)) > echo In interiorul ciclului while: Free=$FREE Buffers=$BUFFERS \ > Cached=$CACHED Apps=$APPS Swap Used=$SWAPUSED Swap Free=$SWAPFREE > done > > echo In afara ciclului while: Free=$FREE Buffers=$BUFFERS \ > Cached=$CACHED Apps=$APPS Swap Used=$SWAPUSED Swap Free=$SWAPFREE > > De ce se pierd valorile variabilelor cand iese din ciclu? >
pt. ca se creeaza local interiorul ciclului (nu sunt globale). > Ce trebuie facut? sa bei o bere ? ;) -- Patrascu Eugeniu <[EMAIL PROTECTED]> Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of any company, unless otherwise specifically stated. -- Pentru dezabonare, trimiteti mail la [EMAIL PROTECTED] cu subiectul 'unsubscribe rlug'. REGULI, arhive si alte informatii: http://www.lug.ro/mlist/
