Difference between revisions of ".bash logout"

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search
m (Text replacement - "<source lang="bash">" to "<syntaxhighlight lang="bash" >")
Line 2: Line 2:
  
 
==Sample $HOME/.bash_logout file==
 
==Sample $HOME/.bash_logout file==
<source lang="bash">clean
+
<syntaxhighlight lang="bash" >clean
 
# clear history
 
# clear history
 
/bin/rm $HOME/.mysql_history
 
/bin/rm $HOME/.mysql_history

Revision as of 22:49, 29 March 2016

This is the individual login shell cleanup file, executed when a login shell exits. This file exists in users home directory i.e. $HOME/.bash_logout. This is useful if you want to run task or another script or command automatically at logout. For example, [clear the mysql command line] history stored in ~/.mysql_history or make backup of files you can use this file.

Sample $HOME/.bash_logout file

<syntaxhighlight lang="bash" >clean

  1. clear history

/bin/rm $HOME/.mysql_history

  1. Backup files to NAS server

~/bin/backup.sh</source>