[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `history -r` can not read from /dev/stdin ?
From: |
Chet Ramey |
Subject: |
Re: `history -r` can not read from /dev/stdin ? |
Date: |
Thu, 16 Aug 2012 22:27:05 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
On 8/16/12 10:11 PM, 郑文辉(Techlive Zheng) wrote:
> 2012/8/17 Chet Ramey <chet.ramey@case.edu>:
>> 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 chet@case.edu http://cnswww.cns.cwru.edu/~chet/