Re: Using history command in bash script
- From: Bert Swart <bertswart@xxxxxxxxx>
- Date: Fri, 24 Feb 2012 14:22:18 +0100
On Fri, Feb 24, 2012 at 01:59:39PM +0100, Johnny Rosenberg wrote:
Den 24 februari 2012 13:12 skrev Johnny Rosenberg <gurus.knugum@xxxxxxxxx>:Yes, set history -a in your .bashrc
Seems not to be possible.
~$ cat > pa
#!/bin/bash
history
history
history
<Ctrl+d>
~$ chmod +x pa
~$ pa
~$
So there seem to be no history entries available when I run history
from a bash script. Why is this?
I also tried to use the ~/.bash_history file, but it doesn't seem like
events are added to it for each command executed, since at least a
couple of ten commands are missing at the end. Seems like things are
added to the .bash_history file ”now and then”, I'm not sure how
often. How can I get around this? Where are the latest history lines
recorded before they are added to the actual .bash_history file?
I'm trying to make a bash script that creates an alias for my last
command and save it in my .bash-aliases file (which is launched from
the .bashrc file), so I need some way to know what my latest command
was.
Kind regards
Johnny Rosenberg
ジョニー・ローゼンバーグ
About that .bash_history file:
At the moment, my history is 620 entries. If I look in the
.bash_history file, the last command there match entry 527 of the
history command's output. Where are the 93 missing entries? Can I
force bash to write those to the .bash_history file?
Kind regards
Johnny Rosenberg
ジョニー・ローゼンバーグ
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- Follow-Ups:
- Re: Using history command in bash script
- From: Johnny Rosenberg
- Re: Using history command in bash script
- References:
- Using history command in bash script
- From: Johnny Rosenberg
- Re: Using history command in bash script
- From: Johnny Rosenberg
- Using history command in bash script
- Prev by Date: Re: Using history command in bash script
- Next by Date: Installing Ubuntu via Wubi and getting Orca up and running automatically
- Previous by thread: Re: Using history command in bash script
- Next by thread: Re: Using history command in bash script
- Index(es):
Relevant Pages
|