Re: bash: fork: Resource temporarily unavailable
On Sun, 08 Sep 2002 12:19:21 PDT, Alex Withers writes:
>On Sun, 8 Sep 2002, Nicos Gollan wrote:
>As it turns out that was it, in a way. I had a line in my .bashrc that
>went like so: PAGER=`which less`. For some reason this would cause a
>momentary explosion in the number of "which" processes. They would
>disappear in a few seconds and I would then get the vague error message.
>I don't know why this caused the problem as $PAGER looked fine after the
>hiccup. But it solved the problem when I removed the problem line...
Of course, this makes sense. When you run a command in backquotes, that
will start a new instance of bash to run that command. And the new bash
you start will read and execute .bashrc. Which will start a new bash,
to evaluate the "which less". This new bash will execute .bashrc,
which tries to evaluate "which less", which starts a new bash shell,
which .... I'm sure you get the idea.
You have essentially created what's called a recursive "fork bomb".
Fortunately, this design of fork bomb stops as soon as it runs out of
You can fix the problem (I expect) like this:
# At start of your .bashrc
if [ -n "$BASH_INITIALIZED" ]
# all your env variable stuff goes here, including
export PAGER=`which less`;