Supondo que os arquivos de histórico estão ocultos (começando com .
), gostaria de fazer o seguinte:
ls -1 ~/.*history
Com saída:
/home/birei/.bash_history
/home/birei/.mysql_history
/home/birei/.ptksh_history
/home/birei/.sqlite_history
/home/birei/.xsh2_history
/home/birei/.xsh_history
Executar:
for hist_file in ~/.*history; do cp "$hist_file" "$hist_file$(date +%m%d%Y).txt"; done
E então:
ls -1 ~/.*history*
Com a seguinte saída:
/home/birei/.bash_history
/home/birei/.bash_history07172012.txt
/home/birei/.mysql_history
/home/birei/.mysql_history07172012.txt
/home/birei/.ptksh_history
/home/birei/.ptksh_history07172012.txt
/home/birei/.sqlite_history
/home/birei/.sqlite_history07172012.txt
/home/birei/.xsh2_history
/home/birei/.xsh2_history07172012.txt
/home/birei/.xsh_history
/home/birei/.xsh_history07172012.txt
Espero que possa ser útil para sua pergunta.