Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread rens
* **=>which read** **which: no read in (/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin)** **3 *read is a built in. there is no subshell. any way, it seems then to me that even IF "read" was a subshell, the scope of

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread Chris Down
On 2013-12-24 09:25:05 +0100, rens wrote: > *read is a built in. there is no subshell. $ echo "$BASHPID"; : | echo "$BASHPID" 26269 26271 > any way, it seems then to me that even IF "read" was a subshell, the scope > of that would start and end with the read statement. I don't know

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread rens
Mr Down, you are a master at evading the issue. and therefore, i.m.h.o, completely useless as a programmer. If you try explain your statements about scope to yourself. you do risk to end up in a endless loop of your own making. I wish you a merry christmas. On 12/24/13 09:29, Chris Down

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread Chris Down
On 2013-12-24 10:16:28 +0100, rens wrote: > you are a master at evading the issue. > > and therefore, i.m.h.o, completely useless as a programmer. You appear to have become confused into thinking that I have an interest in helping people that do not want to listen or learn. I apologise if I misl

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread Greg Wooledge
On Mon, Dec 23, 2013 at 11:57:32PM +0100, rens wrote: > ls -1 /usr/bin|head -10 |while read fname > do > cval=$(( cval +1 )) > echo cval = $cval file = $fname > done > # one would think cval is now 10. but it is not, contrary to any other > programming language > > echo " after while: c

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread Greg Wooledge
On Tue, Dec 24, 2013 at 07:49:28PM +0100, rens wrote: > I understand the technical origin of the behaviour. > Spend +25 yrs in unix. I am so old, that I remember fighting (at my > 40th) with linux 0.79, I think > > However, I am questioning if this is what a programming language should do.

Re: Lengthy working dir (\w) breaks wrapping in a multi line coloured PS1 prompt

2013-12-24 Thread Linda Walsh
Use something to trim your prompt usefully (or rigidly like bash prompt builtin '\w'): --- in your .bashrc define these: # return a shorted path when displayed path would take up > 50% width of screen alias int=declare\ -i _e=echo _pf=printf exp=export ret=return exp __dpf__='local -a P

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread Linda Walsh
rens wrote: this script: ___ export cval=0 echo entering while # listing ten files, to generate some output to count. ls -1 /usr/bin|head -10 |while read fname do cval=$(( cval +1 )) echo cval = $cval file = $fname done # one would think cval is now 10. but it is not, con

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread Pierre Gaston
On Tue, Dec 24, 2013 at 8:56 PM, Greg Wooledge wrote: > On Tue, Dec 24, 2013 at 07:49:28PM +0100, rens wrote: > > I understand the technical origin of the behaviour. > > Spend +25 yrs in unix. I am so old, that I remember fighting (at my > > 40th) with linux 0.79, I think > > > > However, I