[Top][All Lists]

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

process substitution in PROMPT_COMMAND

From: Curtis Doty
Subject: process substitution in PROMPT_COMMAND
Date: Sun, 7 Aug 2011 15:00:14 -0700 (PDT)
User-agent: Alpine 2.00 (LFD 1167 2008-08-23)

I've recently refactored my PROMPT_COMMAND function to avoid superfluous fork()s. In the body of the function, what was once this line:

  local jobcount=$(jobs |wc -l)

is now this:

  local job jobcount=0
  while read job
  do ((jobcount++))
  done < <(jobs)

This works fine on bash 4. However, when attempting to use this on an older bash 3.00.15(1) host, an error occurs; but only on 2nd or additional subshells--not the first login shell!?! I.e. everything works fine, until I run bash from bash.

  bash: foo: line 39: syntax error near unexpected token `('
  bash: foo: line 39: ` done <<(jobs);'
  bash: error importing function definition for `foo'

Am I missing a finer point of redirection from a substituted process? Or is something different in bash 3 that I need to work around here?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]