[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash guru wanted



04.01.2003 01:34:03, Cameron Hutchison <camh+dl@xdna.net> wrote:
>You can do it with the variable PROMPT_COMMAND. Its value is executed
>prior to each prompt.
>
>eg.
>
>function job_test {
>  if [ -z "$(jobs)" ] ; then
>    set +o ignoreeof
>  else
>    set -o ignoreeof
>  fi
>}
>
>PROMPT_COMMAND=job_test
>
>This works with one slight glitch. The order of operations seems to be
>1) run PROMPT_COMMAND
>2) bash checks for completed jobs
>3) print the prompt

Thanx Cameron,
I'm perfectly happy now. Didn't know about PROMPT_COMMAND.

I use this slightly modified version:

function job_test {
  if [ -z "$(jobs -p)" ] ; then
    IGNOREEOF=0
  else
    IGNOREEOF=999999
  fi
}
PROMPT_COMMAND=job_test

since "set -o ignoreeof" only ignores the first 10 ^D and I want it
to be as strict as possible.

Didn't notice the glitch you mentioned, but I'm sure I can live
with it very well.

I also want to thank you, that you read my mail even though
it was a bit noisy (as I noticed right now, I started the body
with the wrong text). Apologies to anyone else who felt disturbed
by my misbehaviour.

Cheers, Michael




Reply to: