[Top][All Lists]
[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 16:28:59 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
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 address@hidden http://cnswww.cns.cwru.edu/~chet/