`history -r` can not read from /dev/stdin ?

2012-08-16 Thread Techlive Zheng
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 ```

Re: `history -r` can not read from /dev/stdin ?

2012-08-16 Thread Chet Ramey
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_his

Re: `history -r` can not read from /dev/stdin ?

2012-08-16 Thread Techlive Zheng
2012/8/17 Chet Ramey : > 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 -

Re: `history -r` can not read from /dev/stdin ?

2012-08-16 Thread Chet Ramey
On 8/16/12 10:11 PM, 郑文辉(Techlive Zheng) wrote: > 2012/8/17 Chet Ramey : >> 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? >>> >>> `

Shell comment ignored

2012-08-16 Thread Keith Clifford
Hi, I first noticed this in a shell script under mingw but tested it in bash under Linux and it has the same behaviour. some_var=# What I thought was a comment. The '#' is eaten by the variable assignment so that some_var gets a null value and the rest of the line is not treated like a com

Re: Shell comment ignored

2012-08-16 Thread Mike Frysinger
On Thursday 16 August 2012 20:36:45 Keith Clifford wrote: > some_var=# What I thought was a comment. > > The '#' is eaten by the variable assignment so that some_var gets a null > value and the rest of the line is not treated like a command. this is correct (if sometimes confusing to people) beha

Re: Shell comment ignored

2012-08-16 Thread Eric Blake
On 08/16/2012 06:36 PM, Keith Clifford wrote: > > some_var=# What I thought was a comment. ^ Not the first byte of a word. # starts a comment only when it is the first byte of a word. You can write: some_var= #Now this is a comment, since there is space between = and # if you meant

Re: `history -r` can not read from /dev/stdin ?

2012-08-16 Thread Techlive Zheng
2012/8/17 Chet Ramey : > On 8/16/12 10:11 PM, 郑文辉(Techlive Zheng) wrote: >> 2012/8/17 Chet Ramey : >>> 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, pleas