bug-bash
[Top][All Lists]
Advanced

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

Re: process substitution in PROMPT_COMMAND


From: Chet Ramey
Subject: Re: process substitution in PROMPT_COMMAND
Date: Sun, 07 Aug 2011 19:04:24 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11

On 8/7/11 7:02 PM, Curtis Doty wrote:
> On Sun, 7 Aug 2011, Chet Ramey wrote:
> 
>> On 8/7/11 6:00 PM, Curtis Doty wrote:
>>>   local job jobcount=0
>>>   while read job
>>>   do ((jobcount++))
>>>   done < <(jobs)
>>
>> As you suspect, the problem is with this part of the function.  It doesn't
>> really have anything to do with PROMPT_COMMAND, though.  You must be
>> exporting the function so your PROMPT_COMMAND will work in interactive
>> subshells, and the problem is there.
> 
> Aha, indeed I have this too:
> 
>   export -f foo
> 
> Removing it and the error goes away on successive subshells. :-)
> 
> I already export PROMPT_COMMAND=foo. Maybe I don't need to try and
> re-export the function every time also?

Well, if the PROMPT_COMMAND is exported to a subshell, and references a
command named `foo', there should be a `foo' for it to execute.  If you
don't export the function, it probably won't find anything.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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