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?
Nu e vorba de in ciclu sau afara! E vorba de alt proces (tot bash dar altul...) free | while read ... do; ..; done > Ce trebuie facut? free | (while read ... do; ..; done; use_those_vars) -- Paul Chitescu [EMAIL PROTECTED] http://pchitescu.null.ro/ ICQ:22641673 Any spammers will be painfully squeezed into /dev/null -- Pentru dezabonare, trimiteti mail la [EMAIL PROTECTED] cu subiectul 'unsubscribe rlug'. REGULI, arhive si alte informatii: http://www.lug.ro/mlist/
