Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
On 12/15/15 11:37 AM, up201407890@alunos.dcc.fc.up.pt wrote:
>> You just need to enable history (set -o history). History is independent
>> of whether or not the shell is interactive; it's just enabled by default
>> in interactive shells.
>
> doing a "set -o history" didn't work for me, only when i added a "history
> -a" eg:
$ cat x19
#!/bin/bash
rm -f /tmp/history # make sure it's not there
set -o history
HISTFILE="/tmp/history"
HISTSIZE="1000"
printf 'something\n'
$ ../bash-4.3-patched/bash ./x19
something
$ ls -l /tmp/history
-rw------- 1 chet wheel 61 Dec 15 11:48 /tmp/history
$ cat /tmp/history
HISTFILE="/tmp/history"
HISTSIZE="1000"
printf 'something\n'
--
``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/