What is the point of this? Whenever I close my shell it appends to the history file without adding this. I have never seen it overwrite my history file.
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Supplementary info, from a bash-related man page:
Quote:
histappend
If set, the history list is appended to the history file when the shell exits,
rather than overwriting the history file.
shopt -s histappend
To append every line to history individually set:
PROMPT_COMMAND='history -a'
With these two settings, a new shell will get the history lines from all previous
shells instead of the default 'last window closed'>history
(the history file is named by the value of the HISTFILE variable)
So adding
in your .bashrc will mimic the behaviour of ksh in that it writes all commands to its history file as (after?) it executes them.
Presumably the correct order of history -a and history -n would allow two or more shells to share their history, exactly like ksh (my least favourite feature of ksh)
Hi,
I am using bash shell's extended pattern matching.
What tweak the following code needs in order to get the expected output?
shopt -s extglob
f="a@b@_c@d@_e"
echo "${f/@(@|@_)/__}"
My expected output is:
a__b__c__d__e
but the actual output is:
a__b@_c@d@_e
# that is, how to... (3 Replies)
Hi,
I am using BASH. In a directory there are files that match either of the following 2 patterns: *.L1A_AC* or S*.L1A_MLAC*
I would like to write a script that will include a for loop, where for each file in the directory, a certain function will be performed. For example:
for FILE in... (4 Replies)