-----Forwarded Message----- > From: Guy Rouillier <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Re: [newbie] 9.1 Sourcing a shell script from .bashrc no longer works > Date: 31 Mar 2003 02:06:35 -0500 > > On Sun, 2003-03-30 at 14:35, Stephen Kuhn wrote: > > On Sun, 2003-03-30 at 17:58, Guy Rouillier wrote: > > > I had the following script that I sourced from .bashrc to let me know > > > when I was running out of disk space. > > > > > > #!/bin/bash > > > df | grep dev | cut -c53-54,56- | while read p1 p2 > > > do > > > if [ $p1 -gt 95 ] > > > then > > > echo "Danger! $p2 is $p1 full!" > > > fi > > > done > > > > > > This worked fine under Mandrake 9.0 and RedHat 8.0. I've just spent 3 > > > tortuous hours determining that sourcing this no longer works. Now I > > > have to simply run it. That is, before where I had > > > > > > source ~/checksize.sh > > > > > > now I must have simply > > > > > > ~/checksize.sh > > > > > > The original method produces this: > > > > > > bash: [: -gt: unary operator expected > > > bash: [: -gt: unary operator expected > > > bash: [: ha: integer expression expected > > > bash: [: oo: integer expression expected > > > bash: [: -gt: unary operator expected > > > > > > The reason that I sourced it originally is that because I was starting a > > > shell script from within .bashrc, I got into an infinite loop. This no > > > longer appears to happen. Why does sourcing no longer work? > > > > That is rather strange, Guy - just as a side note, though, have you > > checked all your lib path and system path statements? > > Thanks for the reply. Path appears to be *mostly* intact: > > /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/games:/home/guyr/bin:/sbin:/usr/sbin > > Upgrading to 9.1 appears to have stuck /usr/games in, but the rest of it > is standard. > > I'm curious why I'm not getting the infinite looping by invoking a shell > script from within .bashrc. I guess bash has changed to detect this > situation and not spawn another shell. I actually prefer this - much > easier just to run the script than to source it. Doesn't help me > understand it, though. > -- > Guy Rouillier <[EMAIL PROTECTED]> -- Guy Rouillier <[EMAIL PROTECTED]>
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com