On 8/16/12 10:11 PM, 郑文辉(Techlive Zheng) wrote:
> 2012/8/17 Chet Ramey <[email protected]>:
>> On 8/16/12 9:17 AM, 郑文辉(Techlive Zheng) wrote:
>>> I was trying to reload the bash history file which changed by another
>>> bash session with the following commands, but it wouldn't work, please
>>> help me, why?
>>>
>>> ```
>>> new_history=$(history -a /dev/stdout)
>>> history -c
>>> history -r
>>> echo "$new_history" | history -r /dev/stdin
>>> ```
>>
>> One possible cause that springs to mind is the fact that the `history -r'
>> at the end of the pipeline is run in a subshell and cannot affect its
>> parent's history list.
>
> So, How could I accomplish this kind of thing?
Why not just use a regular file?
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/