Re: query about history management in bash

2009-12-27 Thread Alex Samad
On Mon, Dec 28, 2009 at 04:32:02AM +0530, Rajarshi Tiwari wrote:
> To @Alex >>
> 
> >couldn't you do
> >unset HISTFILE
> >vim 
> >exit
> 
> I don't follow, but i believe you are trying to suggest that one should
> temporary disable history, edit the file manually, to clean it, and then
> restore.  If this what you suggest, I am already doing it :-) , but looking
> for something that could automate it safely.
no unsetting HISTFILE mean bash will not update the history file, so
edit it with vim and then exit the bash program. I was repling to the
fact that the suggestion was to start the editor in another thread - 

> 
> Rajarshi
> 
> *
>   Rajarshi Tiwari,
>Graduate Student
> (Condensed matter Physics)
>Harish Chandra Research Institute
>Allahabad-211019
>   ph.0532-227-4405 (O)
>   ph.0532-227-4139 (R)
> http://www.hri.res.in/~rajarshi
> *

-- 
The words fly away, the writings remain.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Re: query about history management in bash

2009-12-27 Thread Rajarshi Tiwari
To @Alex >>

>couldn't you do
>unset HISTFILE
>vim 
>exit

I don't follow, but i believe you are trying to suggest that one should
temporary disable history, edit the file manually, to clean it, and then
restore.  If this what you suggest, I am already doing it :-) , but looking
for something that could automate it safely.

Rajarshi

*
  Rajarshi Tiwari,
   Graduate Student
(Condensed matter Physics)
   Harish Chandra Research Institute
   Allahabad-211019
  ph.0532-227-4405 (O)
  ph.0532-227-4139 (R)
http://www.hri.res.in/~rajarshi
*


Re: query about history management in bash

2009-12-27 Thread Alex Samad
On Sun, Dec 27, 2009 at 04:01:00PM +0100, Michelle Konzack wrote:
> Ram ram Rajarshi,
> 
> Am 2009-12-27 11:39:28, schrieb Rajarshi Tiwari:
> > Dear friends,
> > Consider following situation -
[snip]
> 
> NOTE:   The helperprogramm to do this has  not  to  be
> executed by the current shell  but  should  be
> sourced, otherwise you will get weird results.
couldn't you do 
unset HISTFILE
vim 
exit 

> 
> > Thanks in advance :-)
> > 
> > Rajarshi
> 
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
> Systemadministrator
> Tamay Dogan Network
> Debian GNU/Linux Consultant
> 



-- 
Real Users never use the Help key.


signature.asc
Description: Digital signature


Re: query about history management in bash

2009-12-27 Thread Michelle Konzack
Ram ram Rajarshi,

Am 2009-12-27 11:39:28, schrieb Rajarshi Tiwari:
> Dear friends,
> Consider following situation -
> 
> We write a lot commands, and make many typing errors. (e.g typed s instead
> of ls, eco instead of echo and so on). These miss-typed commands are also
> saved in history and create unnecessary crowd in the HISTFILE. Is there any
> way to avoid this? More precisely, something that can decide whether to save
> a command based on its exit status, or if $0 (in language of bash) is an
> existing command.

This would not work, ich you have functions loaded from ~/.bashrc 

which some_func_in_memory

return nothing...

> I did basic homework of searching the manpages of bash, history and also
> google a bit, but didn't find anything useful.

The only possibilit ist to use bash native command to save  the  current
history manualy, then use an dedicated program (simple bash script using
dialog/xdialog) which load the saved history delete the  erronus  lines,
save it back and reload it from your bash.

NOTE:   The helperprogramm to do this has  not  to  be
executed by the current shell  but  should  be
sourced, otherwise you will get weird results.

> Thanks in advance :-)
> 
> Rajarshi

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
 Michelle Konzack
   Apt. 917
   50, rue de Soultz
Jabber linux4miche...@jabber.ccc.de   67100 Strabourg/France
IRC#Debian (irc.icq.com)  Tel. DE: +49 177 9351947
ICQ#328449886 Tel. FR: +33  6  61925193


signature.pgp
Description: Digital signature


query about history management in bash

2009-12-26 Thread Rajarshi Tiwari
Dear friends,
Consider following situation -

We write a lot commands, and make many typing errors. (e.g typed s instead
of ls, eco instead of echo and so on). These miss-typed commands are also
saved in history and create unnecessary crowd in the HISTFILE. Is there any
way to avoid this? More precisely, something that can decide whether to save
a command based on its exit status, or if $0 (in language of bash) is an
existing command.

I did basic homework of searching the manpages of bash, history and also
google a bit, but didn't find anything useful.

Thanks in advance :-)

Rajarshi