Dang it! I may coincidentally have just found a fairly profound
bash bug related to usage of that spew | while read idiom.
Here's what I do to cause bash to say Segmentation fault
cd /
find . -type f | while read f
do
ls -laFd $f
done
Collecting the list in a file first
Interesting:
find . -type f | while read f; do true $f ; done #Builtin - works
find . -type f | while read f; do /bin/true $f ; done #Chokes
...a memory leak somewhere in the fork() path?
*
To unsubscribe from
On Wed, 24 Apr 2002, at 10:43am, Michael O'Donnell wrote:
...a memory leak somewhere in the fork() path?
Try:
while true ; do /bin/true ; done
--
Ben Scott [EMAIL PROTECTED]
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Content-Type: text/plain; charset=us-ascii
In a message dated: Wed, 24 Apr 2002 10:53:58 EDT
Benjamin Scott said:
Try:
while true ; do /bin/true ; done
I think there's a bug here. Nothing happens, well, at least not so far... ;)
- --
On Wed, 24 Apr 2002, at 10:57am, [EMAIL PROTECTED] wrote:
Nothing happens ...
Try xyzzy. ;-)
--
Ben Scott [EMAIL PROTECTED]
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or |
|
pll wrote:
while true ; do /bin/true ; done
I think there's a bug here. Nothing happens, well, at least not so far... ;)
Well, we ARE getting pretty minimalistic here.
Of course, if it's true that
Every program has at least one bug.
...and
Every program can be reduced in
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Content-Type: text/plain; charset=us-ascii
In a message dated: Wed, 24 Apr 2002 11:02:46 EDT
Michael O'Donnell said:
...then
Every program can be reduced to one
instruction that does not work.
I thought it was:
Every program can
Ha! I haven't analyzed this yet (and might never) but running bash
under GDB (actually, I attached GDB to the child bash proc) yields:
Program received signal SIGABRT, Aborted.
0x400497b1 in kill () from /lib/libc.so.6
(gdb) where
#0 0x400497b1 in kill () from /lib/libc.so.6
#1
This is a VAX system you're trying it on?!? :)
On Wed, 24 Apr 2002, Benjamin Scott wrote:
Try xyzzy. ;-)
*
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Content-Type: text/plain; charset=us-ascii
In a message dated: Wed, 24 Apr 2002 11:32:38 EDT
Michael O'Donnell said:
Ha! I haven't analyzed this yet (and might never) but running bash
under GDB (actually, I attached GDB to the child bash proc)
I'm interpreting this as an out-of-memory error as
a result of too many file names filling up an array?
Is that an accurate interpretation of this trace?
Nope - this problem was detected (though not necessarily
caused) in the implementation of malloc()/free() that comes
with the bash
On Wed, 24 Apr 2002, at 11:47am, [EMAIL PROTECTED] wrote:
I'm interpreting this as an out-of-memory error as a result of too many
file names filling up an array? Is that an accurate interpretation of
this trace?
No, what happened is that the heap management routines detected a
corrupion
On Wed, Apr 24, 2002 at 11:47:28AM -0400, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
If so, why would you use an array for this sort of thing. Way back
in time when I was taking Intro to Programming, they taught us to use
linked lists for this type of scenario where you didn't know up front
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Content-Type: text/plain; charset=us-ascii
In a message dated: Mon, 22 Apr 2002 17:48:27 EDT
Benjamin Scott said:
On Mon, 22 Apr 2002, at 2:15pm, [EMAIL PROTECTED] wrote:
If they only exist within bash, then I wouldn't advocate their use if
Derek D. Martin [EMAIL PROTECTED] writes:
At some point hitherto, Kevin D. Clark hath spake thusly:
In general, the inner part of the loop is run in a sub-shell.
Not exactly... it's more subtle even than that. For example:
Yes, my language could have been a little tighter there. In
This is a classic example of why I prefer doing actual
script work in ksh and have my login shell as bash.
Aren't you just saying that you prefer to stick with a
familiar set of idiosyncracies for scripting purposes?
*
To
On Tue, 23 Apr 2002, at 11:00am, Michael O'Donnell wrote:
This is a classic example of why I prefer doing actual
script work in ksh and have my login shell as bash.
Aren't you just saying that you prefer to stick with a familiar set of
idiosyncracies for scripting purposes?
Heh. That is
DISKHOG=`echo 1234M /home/USER | sed -e 's;^.*/;;'`
*
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
How about something like:
du -sb ./*|sort -g|tail|sed 's/\.\///'|awk '{print $2}'
to get the names... and then wrap it up in a mail command... it's not a
bash script since it forks a few times, but it's a quick'n'dirty.
Ben
On Mon, 22 Apr 2002, Brian Chabot wrote:
Hey, all -
I'm
On Mon, 22 Apr 2002 [EMAIL PROTECTED] wrote:
I said:
in other words, given: 1234M /home/USER I want USER so as to then turn
around and email that user. (I already have
way of removing non-user directories in /home).
Woo hoo!
Thanks for all the lightning fast help.
I already had most
On Mon, Apr 22, 2002 at 12:16:15PM -0400, Brian Chabot [EMAIL PROTECTED] wrote:
On Mon, 22 Apr 2002 [EMAIL PROTECTED] wrote:
I said:
in other words, given: 1234M /home/USER I want USER so as to then turn
around and email that user. (I already have
way of removing non-user
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Content-Type: text/plain; charset=us-ascii
In a message dated: Mon, 22 Apr 2002 14:03:32 EDT
Bob Bell said:
Look at the bash man page for '#', '##', '%', and '%%'.
Are these built-ins also available in the real Bourne Shell, and/or ksh?
Or
Yuck, yuck, yuck! It looks like everyone was pointing out ways to
use sed to accomplish this. Now, sed may give you extra
power, but when
writing shell scripts, I prefer to avoid using external commands where
possible. To that extent, consider:
$ foo=1234M /home/USER
$ echo
Mansur, Warren [EMAIL PROTECTED] writes:
Does anyone know how to loop through each line instead, so that the output would be
line 1
line 2
? Thanks.
echo -ne 'line 1\nline 2\n' | while read foo ; do echo $foo ; done
--
John Abreau / Executive Director, Boston Linux Unix
ICQ 28611923
I have not tried it, but what about setting IFS to newline only.
n 22 Apr 2002 at 14:42, Mansur, Warren wrote:
Does anyone know how to loop through each line instead, so that the output would
be
line 1
line 2
? Thanks.
--
Jerry Feldman [EMAIL PROTECTED]
Associate Director
Boston Linux
On Mon, Apr 22, 2002 at 02:15:14PM -0400, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
In a message dated: Mon, 22 Apr 2002 14:03:32 EDT
Bob Bell said:
Look at the bash man page for '#', '##', '%', and '%%'.
Are these built-ins also available in the real Bourne Shell, and/or ksh?
Or
it has a subtle scoping gotcha that drove me nuts the
first time I tripped over it - anybody know what I'm
referring to?
No? Then how about this?
result=badness# init with failure default
spewSomeKindOfOutput | while read input
do
result=goodness
done
echo $result
No? Then how about this?
result=badness# init with failure default
spewSomeKindOfOutput | while read input
do
result=goodness
done
echo $result
What is the output?
badness
Lemme guess. The pipe to the while actually creates a child process, and a child
echo -ne 'line 1\nline 2\n' | while read foo ; do echo $foo ; done
Thanks to all for their answers. I've always wanted to do this but
didn't know how until now. Works like a charm!
Warren
*
To unsubscribe from this list, send
[EMAIL PROTECTED] (Michael O'Donnell) writes:
it has a subtle scoping gotcha that drove me nuts the
first time I tripped over it - anybody know what I'm
referring to?
No? Then how about this?
result=badness# init with failure default
spewSomeKindOfOutput | while read input
On Mon, Apr 22, 2002 at 05:15:00PM -0400, Mansur, Warren [EMAIL PROTECTED]
wrote:
No? Then how about this?
result=badness# init with failure default
spewSomeKindOfOutput | while read input
do
result=goodness
done
echo $result
What is the output?
On Mon, 22 Apr 2002, at 2:15pm, [EMAIL PROTECTED] wrote:
If they only exist within bash, then I wouldn't advocate their use if
you're goal is portable shell code.
If portability is a concern, depending on the environment, it is sometimes
easier to install the GNU tools everywhere than try to
In general, I try to write my scripts portable so that I can use them on
other platforms. In the past 5 years, I have had jobs with Tru64 Unix, HP-
UX (10.20 and 11.x), Solaris (7 and 8), and Linux (Debian, Red Hat and
SuSE). Most of my personal scripts are small and work across platform. My
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
At some point hitherto, Kevin D. Clark hath spake thusly:
result=badness# init with failure default
spewSomeKindOfOutput | while read input
do
result=goodness
done
echo $result
What is the output?
In
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
At some point hitherto, Benjamin Scott hath spake thusly:
If portability is a concern, depending on the environment, it is sometimes
easier to install the GNU tools everywhere than try to craft something that
works on all the native tools.
35 matches
Mail list logo