public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] bash_history
@ 2006-03-07  0:17 Goran Maksimović
  2006-03-07  0:39 ` Haim Ashkenazi
  0 siblings, 1 reply; 16+ messages in thread
From: Goran Maksimović @ 2006-03-07  0:17 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

Hello!

 

I am wondering what do I need to config so that when a user or root type
reboot the commands typed before a saved in bash_history and also when the
user or root don' type anything but just press combination of keys
ctrl+alt+del?

 

Goran


[-- Attachment #2: Type: text/html, Size: 2121 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] bash_history
  2006-03-07  0:17 [gentoo-user] bash_history Goran Maksimović
@ 2006-03-07  0:39 ` Haim Ashkenazi
  2006-03-07  2:46   ` [gentoo-user] bash_history Tim Kruse
  2006-03-07 10:10   ` [gentoo-user] bash_history Matteo Lanza
  0 siblings, 2 replies; 16+ messages in thread
From: Haim Ashkenazi @ 2006-03-07  0:39 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

On Tue, 2006-03-07 at 01:17 +0100, Goran Maksimović wrote:
> Hello!
> 
>  
> 
> I am wondering what do I need to config so that when a user or root
> type reboot the commands typed before a saved in bash_history and also
> when the user or root don' type anything but just press combination of
> keys ctrl+alt+del?
when you press reboot the shell process dies, so it doesn't save the
history. if you want to save history you have to exit the shell and then
login and enter reboot, or press ctrl+alt+del. 

Bye
-- 
Haim

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user]  Re: bash_history
  2006-03-07  0:39 ` Haim Ashkenazi
@ 2006-03-07  2:46   ` Tim Kruse
  2006-03-07  8:25     ` Haim Ashkenazi
  2006-03-07 22:58     ` Harry Putnam
  2006-03-07 10:10   ` [gentoo-user] bash_history Matteo Lanza
  1 sibling, 2 replies; 16+ messages in thread
From: Tim Kruse @ 2006-03-07  2:46 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]

* On 07.03.2006 Haim Ashkenazi wrote:

>> I am wondering what do I need to config so that when a user or root
>> type reboot the commands typed before a saved in bash_history and also
>> when the user or root don' type anything but just press combination of
>> keys ctrl+alt+del?
> when you press reboot the shell process dies, so it doesn't save the
> history. if you want to save history you have to exit the shell and then
> login and enter reboot, or press ctrl+alt+del.

 I love zsh ;-)

,-----
| % setopt | grep -i "append.*history"
| incappendhistory
| % man zshoptions | col -b | grep -A 4 APPEND_HISTORY
|     APPEND_HISTORY <D>
|         If this is set, zsh sessions will append their history  list  to
|         the  history file, rather than overwrite it. Thus, multiple par-
|         allel zsh sessions will all have their history  lists  added  to
|         the history file, in the order they are killed.
|--
|     INC_APPEND_HISTORY
|         This options works like APPEND_HISTORY except that  new  history
|         lines  are added to the $HISTFILE incrementally (as soon as they
|         are entered), rather than waiting until  the  shell  is  killed.
|         The  file  is periodically trimmed to the number of lines speci-
|         fied by $SAVEHIST, but can exceed this value between  trimmings.
`-----

 So long,
tkr

-- 
"There are some good people in it, but the orchestra as a whole is equivalent
to a gang bent on destruction."
-- John Cage, composer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: bash_history
  2006-03-07  2:46   ` [gentoo-user] bash_history Tim Kruse
@ 2006-03-07  8:25     ` Haim Ashkenazi
  2006-03-07 22:58     ` Harry Putnam
  1 sibling, 0 replies; 16+ messages in thread
From: Haim Ashkenazi @ 2006-03-07  8:25 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

On Tue, 2006-03-07 at 03:46 +0100, Tim Kruse wrote:
> * On 07.03.2006 Haim Ashkenazi wrote:
> 
> >> I am wondering what do I need to config so that when a user or root
> >> type reboot the commands typed before a saved in bash_history and also
> >> when the user or root don' type anything but just press combination of
> >> keys ctrl+alt+del?
> > when you press reboot the shell process dies, so it doesn't save the
> > history. if you want to save history you have to exit the shell and then
> > login and enter reboot, or press ctrl+alt+del.
check out also the history command in bash ('help history'). it has some
commands to write or append the current history to a file (I never used
it, just looked at the man page).

if it works you can have alias to 'history -a $HISTFILE
&& /sbin/reboot'. of course you have to check the history options.

Bye
-- 
Haim

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: bash_history
@ 2006-03-07  8:42 Goran Maksimoviæ
  2006-03-07 19:39 ` Simon Kellett
  0 siblings, 1 reply; 16+ messages in thread
From: Goran Maksimoviæ @ 2006-03-07  8:42 UTC (permalink / raw
  To: gentoo-user


> On Tue, 2006-03-07 at 03:46 +0100, Tim Kruse wrote:
> > * On 07.03.2006 Haim Ashkenazi wrote:
> > 
> > >> I am wondering what do I need to config so that when a user or root
> > >> type reboot the commands typed before a saved in bash_history and also
> > >> when the user or root don' type anything but just press combination of
> > >> keys ctrl+alt+del?
> > > when you press reboot the shell process dies, so it doesn't save the
> > > history. if you want to save history you have to exit the shell and
the> n
> > > login and enter reboot, or press ctrl+alt+del.
> check out also the history command in bash ('help history'). it has some
> commands to write or append the current history to a file (I never used
> it, just looked at the man page).
> 
> if it works you can have alias to 'history -a $HISTFILE
> && /sbin/reboot'. of course you have to check the history options.
> 
> Bye
> -- 
> Haim
> 



Yes, but is there someway that when i press ctrl-alt-del that before Linux goes
in the process of reboot he previously log outs and then he goes in the process
of reboot?

Bye 

Goran

---------------------- T - C o m - - W e b m a i l ----------------------
Ova poruka poslana je upotrebom T-Com Webmail usluge.
Postani redatelj najgledanijeg hrvatskog filma!
http://www.tportal.hr/100sekundislave/



-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user] bash_history
  2006-03-07  0:39 ` Haim Ashkenazi
  2006-03-07  2:46   ` [gentoo-user] bash_history Tim Kruse
@ 2006-03-07 10:10   ` Matteo Lanza
  1 sibling, 0 replies; 16+ messages in thread
From: Matteo Lanza @ 2006-03-07 10:10 UTC (permalink / raw
  To: gentoo-user

On 3/7/06, Haim Ashkenazi <haim@babysnakes.org> wrote:
> when you press reboot the shell process dies, so it doesn't save the
> history. if you want to save history you have to exit the shell and then
> login and enter reboot, or press ctrl+alt+del.

What about putting the following:

    trap "history -w" EXIT

in ~/.bash_profile or /etc/profile?

This way the current history is flushed when the shell exits.

My 2c

--
Matteo Lanza
matteo.lanza@gmail.com

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user] Re: bash_history
  2006-03-07  8:42 [gentoo-user] bash_history Goran Maksimoviæ
@ 2006-03-07 19:39 ` Simon Kellett
  0 siblings, 0 replies; 16+ messages in thread
From: Simon Kellett @ 2006-03-07 19:39 UTC (permalink / raw
  To: gentoo-user

Goran Maksimoviæ <goran.maksimovic@ri.htnet.hr> writes:

> Yes, but is there someway that when i press ctrl-alt-del that before Linux goes
> in the process of reboot he previously log outs and then he goes in the process
> of reboot?

I have not tried it but, for example my /etc/inittab has a line:

ca:12345:ctrlaltdel:/sbin/shutdown -h now

I am guessing that you could replace the shutdown command with a script
of your own that does whatever you want, and then finally calls shutdown
?

-- 
Simon Kellett,        |   Gentoo Linux, Fvwm, Firefox 
Darmstadt, Germany    |              Xemacs, Vm, Gnus


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user]  Re: bash_history
  2006-03-07  2:46   ` [gentoo-user] bash_history Tim Kruse
  2006-03-07  8:25     ` Haim Ashkenazi
@ 2006-03-07 22:58     ` Harry Putnam
  2006-03-18  9:17       ` Tim Kruse
  2006-03-18  9:24       ` Tim Kruse
  1 sibling, 2 replies; 16+ messages in thread
From: Harry Putnam @ 2006-03-07 22:58 UTC (permalink / raw
  To: gentoo-user

Tim Kruse <irrlicht2c@gmx.net> writes:

>  I love zsh ;-)
>
> ,-----
> | % setopt | grep -i "append.*history"
> | incappendhistory
> | % man zshoptions | col -b | grep -A 4 APPEND_HISTORY
> |     APPEND_HISTORY <D>
> |         If this is set, zsh sessions will append their history  list  to
> |         the  history file, rather than overwrite it. Thus, multiple par-
> |         allel zsh sessions will all have their history  lists  added  to
> |         the history file, in the order they are killed.
> |--
> |     INC_APPEND_HISTORY
> |         This options works like APPEND_HISTORY except that  new  history
> |         lines  are added to the $HISTFILE incrementally (as soon as they
> |         are entered), rather than waiting until  the  shell  is  killed.
> |         The  file  is periodically trimmed to the number of lines speci-
> |         fied by $SAVEHIST, but can exceed this value between  trimmings.
> `-----

I'd love it more if they bothered to tell you how to set this stuff.

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: bash_history
@ 2006-03-08 12:14 Goran Maksimoviæ
  0 siblings, 0 replies; 16+ messages in thread
From: Goran Maksimoviæ @ 2006-03-08 12:14 UTC (permalink / raw
  To: gentoo-user


> Tim Kruse <irrlicht2c@gmx.net> writes:
> 
> >  I love zsh ;-)
> >
> > ,-----
> > | % setopt | grep -i "append.*history"
> > | incappendhistory
> > | % man zshoptions | col -b | grep -A 4 APPEND_HISTORY
> > |     APPEND_HISTORY <D>
> > |         If this is set, zsh sessions will append their history  list  to
> > |         the  history file, rather than overwrite it. Thus, multiple par-
> > |         allel zsh sessions will all have their history  lists  added  to
> > |         the history file, in the order they are killed.
> > |--
> > |     INC_APPEND_HISTORY
> > |         This options works like APPEND_HISTORY except that  new  history
> > |         lines  are added to the $HISTFILE incrementally (as soon as they
> > |         are entered), rather than waiting until  the  shell  is  killed.
> > |         The  file  is periodically trimmed to the number of lines speci-
> > |         fied by $SAVEHIST, but can exceed this value between  trimmings.
> > `-----
> 
> I'd love it more if they bothered to tell you how to set this stuff.
> 
> -- 
> gentoo-user@gentoo.org mailing list
> 

Yes it would be lovely :), but I prefer bash.


---------------------- T - C o m - - W e b m a i l ----------------------
Ova poruka poslana je upotrebom T-Com Webmail usluge.
T-Com te vodi na Svjetsko nogometno prvenstvo
http://www.t-com.hr/naslovnica/nogomet/



-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user]  Re: bash_history
  2006-03-07 22:58     ` Harry Putnam
@ 2006-03-18  9:17       ` Tim Kruse
  2006-03-18 23:07         ` Neil Bothwick
  2006-03-18  9:24       ` Tim Kruse
  1 sibling, 1 reply; 16+ messages in thread
From: Tim Kruse @ 2006-03-18  9:17 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

* On 07.03.2006 Harry Putnam wrote:

> Tim Kruse <irrlicht2c@gmx.net> writes:
> 
>>  I love zsh ;-)
>>
>> ,-----
>> | % setopt | grep -i "append.*history"
>> | incappendhistory
>> | % man zshoptions | col -b | grep -A 4 APPEND_HISTORY
>> |     APPEND_HISTORY <D>
>> |         If this is set, zsh sessions will append their history  list  to
>> |         the  history file, rather than overwrite it. Thus, multiple par-
>> |         allel zsh sessions will all have their history  lists  added  to
>> |         the history file, in the order they are killed.
>> |--
>> |     INC_APPEND_HISTORY
>> |         This options works like APPEND_HISTORY except that  new  history
>> |         lines  are added to the $HISTFILE incrementally (as soon as they
>> |         are entered), rather than waiting until  the  shell  is  killed.
>> |         The  file  is periodically trimmed to the number of lines speci-
>> |         fied by $SAVEHIST, but can exceed this value between  trimmings.
>> `-----
>
> I'd love it more if they bothered to tell you how to set this stuff.

 Like you set all options in zsh ...

setopt INC_APPEND_HISTORY  # incrementally append history to $HISTFILE

 So long,
tkr

-- 
A countryman between two lawyers is like a fish between two cats.
		-- Ben Franklin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user]  Re: bash_history
  2006-03-07 22:58     ` Harry Putnam
  2006-03-18  9:17       ` Tim Kruse
@ 2006-03-18  9:24       ` Tim Kruse
  1 sibling, 0 replies; 16+ messages in thread
From: Tim Kruse @ 2006-03-18  9:24 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

* On 07.03.2006 Harry Putnam wrote:

> I'd love it more if they bothered to tell you how to set this stuff.

 A second notice to that.

 'man zshoptions' says it all. You even haven't to scroll down as
it is all mentioned on the first page ...

 So long,
tkr

-- 
MSDOS didn't get as bad as it is overnight -- it took over ten years
of careful development.
	-- dmeggins@aix1.uottawa.ca

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: bash_history
  2006-03-18  9:17       ` Tim Kruse
@ 2006-03-18 23:07         ` Neil Bothwick
  2006-03-19  8:18           ` Tim Kruse
  0 siblings, 1 reply; 16+ messages in thread
From: Neil Bothwick @ 2006-03-18 23:07 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

On Sat, 18 Mar 2006 10:17:19 +0100, Tim Kruse wrote:

>  Like you set all options in zsh ...
> 
> setopt INC_APPEND_HISTORY  # incrementally append history to $HISTFILE

Not that different from Bash then? :-)

shopt -s histappend


-- 
Neil Bothwick

WinErr 018: Unrecoverable error - System has been destroyed. Buy a new
one. Old Windows licence is not valid anymore.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [gentoo-user]  Re: bash_history
  2006-03-18 23:07         ` Neil Bothwick
@ 2006-03-19  8:18           ` Tim Kruse
  2006-03-19 16:06             ` Neil Bothwick
  2006-03-19 17:37             ` Octavio Ruiz (Ta^3)
  0 siblings, 2 replies; 16+ messages in thread
From: Tim Kruse @ 2006-03-19  8:18 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]

* On 18.03.2006 Neil Bothwick wrote:

> On Sat, 18 Mar 2006 10:17:19 +0100, Tim Kruse wrote:
>
>>  Like you set all options in zsh ...
>>
>> setopt INC_APPEND_HISTORY  # incrementally append history to $HISTFILE
>
> Not that different from Bash then? :-)
>
> shopt -s histappend

 Do you mean the option itself or setting options? Setting
options is not so different in the most shells I think.

 If you mean the option itself then ...

,-----
| % man bash | col -b | grep -A 3 histappend
|     histappend
|         If  set,  the history list is appended to the file named
|         by the value of the HISTFILE  variable  when  the  shell
|         exits, rather than overwriting the file.
| %
| % man zshoptions | col -b | grep -A 5 APPEND_HISTORY
|     APPEND_HISTORY <D>
|         If this is set, zsh sessions will append their history  list  to
|         the  history file, rather than overwrite it. Thus, multiple par-
|         allel zsh sessions will all have their history  lists  added  to
|         the history file, in the order they are killed.
|
| ---
|     INC_APPEND_HISTORY
|         This options works like APPEND_HISTORY except that  new  history
|         lines  are added to the $HISTFILE incrementally (as soon as they
|         are entered), rather than waiting until  the  shell  is  killed.
|         The  file  is periodically trimmed to the number of lines speci-
|         fied by $SAVEHIST, but can exceed this value between  trimmings.
`-----

 You see the difference? :-P

 So long,
tkr

-- 
What you don't know can hurt you, only you won't know it.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: bash_history
  2006-03-19  8:18           ` Tim Kruse
@ 2006-03-19 16:06             ` Neil Bothwick
  2006-03-19 17:37             ` Octavio Ruiz (Ta^3)
  1 sibling, 0 replies; 16+ messages in thread
From: Neil Bothwick @ 2006-03-19 16:06 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

On Sun, 19 Mar 2006 09:18:58 +0100, Tim Kruse wrote:

>  You see the difference? :-P

Yes. One up to zsh it would appear, there;'s no such option in Bash.


-- 
Neil Bothwick

Your lack of organisation does not represent an
emergency in my world.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: bash_history
  2006-03-19  8:18           ` Tim Kruse
  2006-03-19 16:06             ` Neil Bothwick
@ 2006-03-19 17:37             ` Octavio Ruiz (Ta^3)
  2006-03-20  9:31               ` Neil Bothwick
  1 sibling, 1 reply; 16+ messages in thread
From: Octavio Ruiz (Ta^3) @ 2006-03-19 17:37 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

Tim Kruse, who happens to be smarter than you, thinks:
> * On 18.03.2006 Neil Bothwick wrote:
> > On Sat, 18 Mar 2006 10:17:19 +0100, Tim Kruse wrote:
> >
> >>  Like you set all options in zsh ...
> >> setopt INC_APPEND_HISTORY  # incrementally append history to $HISTFILE
> >
> > Not that different from Bash then? :-)
> > shopt -s histappend
> 
>  Do you mean the option itself or setting options? Setting
> options is not so different in the most shells I think.
> 
>  If you mean the option itself then ...

You also want to set,

export PROMPT_COMMAND="${PROMPT_COMMAND:+${PROMPT_COMMAND} ;} history -a"

in cojuction with histappend.

-- 
It's not pretty being easy.

[-- Attachment #2: Type: application/pgp-signature, Size: 199 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [gentoo-user]  Re: bash_history
  2006-03-19 17:37             ` Octavio Ruiz (Ta^3)
@ 2006-03-20  9:31               ` Neil Bothwick
  0 siblings, 0 replies; 16+ messages in thread
From: Neil Bothwick @ 2006-03-20  9:31 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

On Sun, 19 Mar 2006 11:37:57 -0600, Octavio Ruiz (Ta^3) wrote:

> You also want to set,
> 
> export PROMPT_COMMAND="${PROMPT_COMMAND:+${PROMPT_COMMAND} ;} history -a"
> 
> in cojuction with histappend.

This results in PROMPT_COMMAND being set to "history -a; history -a"
after using su. It is added for the initial login and again for the root
login. However, "PROMPT_COMMAND="history -a" seems to work, as I don't
use PROMPT_COMMAND for anything else.

echo $PROMPT_COMMAND | grep -q history\ -a || export PROMPT_COMMAND...

should take care of it in a more general case.


-- 
Neil Bothwick

Top Oxymorons Number 43: Genuine imitation

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-03-20  9:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-07  0:17 [gentoo-user] bash_history Goran Maksimović
2006-03-07  0:39 ` Haim Ashkenazi
2006-03-07  2:46   ` [gentoo-user] bash_history Tim Kruse
2006-03-07  8:25     ` Haim Ashkenazi
2006-03-07 22:58     ` Harry Putnam
2006-03-18  9:17       ` Tim Kruse
2006-03-18 23:07         ` Neil Bothwick
2006-03-19  8:18           ` Tim Kruse
2006-03-19 16:06             ` Neil Bothwick
2006-03-19 17:37             ` Octavio Ruiz (Ta^3)
2006-03-20  9:31               ` Neil Bothwick
2006-03-18  9:24       ` Tim Kruse
2006-03-07 10:10   ` [gentoo-user] bash_history Matteo Lanza
  -- strict thread matches above, loose matches on Subject: below --
2006-03-07  8:42 [gentoo-user] bash_history Goran Maksimoviæ
2006-03-07 19:39 ` Simon Kellett
2006-03-08 12:14 Goran Maksimoviæ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox