[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: query about history management in bash



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 #####################
<http://www.tamay-dogan.net/>                 Michelle Konzack
<http://www.can4linux.org/>                   Apt. 917
<http://www.flexray4linux.org/>               50, rue de Soultz
Jabber linux4michelle@jabber.ccc.de           67100 Strabourg/France
IRC    #Debian (irc.icq.com)                  Tel. DE: +49 177 9351947
ICQ    #328449886                             Tel. FR: +33  6  61925193

Attachment: signature.pgp
Description: Digital signature


Reply to: