[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `history -r` can not read from /dev/stdin ?
From: |
Techlive Zheng |
Subject: |
Re: `history -r` can not read from /dev/stdin ? |
Date: |
Fri, 17 Aug 2012 10:11:30 +0800 |
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.
>
>
>
> --
> ``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/
So, How could I accomplish this kind of thing?