shell-script-pt
[Top][All Lists]
Advanced

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

Re: [shell-script] [ History ] - Não funciona no shell


From: Paulo Bettega
Subject: Re: [shell-script] [ History ] - Não funciona no shell
Date: Sat, 20 Sep 2014 01:12:18 -0300
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.1.0

Dei uma olhada no man bash e, se entendi direito, essas variáveis podem 
resolver.
As alterações devem ser feitas no .bashrc (ou .bash_profile) do usuário,
então algum usuário mais curioso pode mudar os valores.

unset HISTFILE
Nenhum histórico é salvo. O problema é que o .bash_history existente não é
apagado, tem que apagar na mão.

HISTFILE
              The name of the file in which command history is saved (see HIS‐
              TORY below).  The default value is ~/.bash_history.   If  unset,
              the command history is not saved when a shell exits.



HISTFILESIZE=0
O .bash_history fica com tamanho zero.

HISTFILESIZE
              The maximum number of lines contained in the history file.  When
              this variable is assigned a value, the  history  file  is  trun‐
              cated,  if  necessary,  to  contain  no more than that number of
              lines by removing the oldest entries.  The history file is  also
              truncated  to this size after writing it when a shell exits.  If
              the value is 0, the history file  is  truncated  to  zero  size.
              Non-numeric  values  and  numeric  values less than zero inhibit
              truncation.  The shell sets the default value to  the  value  of
              HISTSIZE after reading any startup files.


On 19-09-2014 22:08, Gustavo Filgueiras address@hidden [shell-script] wrote:
Caros,

      estou tentando realizar via shell script a limpeza do history dos 
usuário, mas não tenho tido
sucesso.

      Método 1:
      Tentei usar o comando history -c, funciona muito bem quando executado na 
linha de comando, mas
via shell script não funciona, tentei algumas variações como `history -c` mas 
não funciona.

      Método 2:
      Removendo os arquivos .bash_history dos usuários, porém, mesmo removendo 
os arquivos, bootando
o servidor, quando eu me logo novamente o history continua intacto.

     Método 3:
     Realizar um unset nas varáveis HIST_SIZE e HIST_FILESIZE, mas mesmo assim, 
não consigo pagar o
history dos usuários.


Alguém consegue me ajudar? Para a mim a solução ideal seria usando o history -c.

Att,
Gustavo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]