was reading "man bash" and ran across this:
"When an interactive login shell exits, or a non-interactive login shell executes the exit builtin command, bash reads and executes commands from the files ~/.bash_logout and /etc/bash.bash_logout, if the files exists."
i was totally unaware of the system-wide logout file /etc/bash.bash_logout, so i tested it and it seemed to have no effect, so i RTFS for bash and, in the CHANGES file, there was this from way back:
"This document details the changes between this version, bash-2.0-beta2, and the previous version, bash-2.0-beta1.
... snip ...
There is a new #define available in config.h.top: SYS_BASH_LOGOUT. If defined to a filename, bash reads and executes commands from that file when a login shell exits. It's commented out by default."
sure enough, in the current source in that file:
/* System-wide .bashrc file for interactive shells. */ /* #define SYS_BASHRC "/etc/bash.bashrc" */
/* System-wide .bash_logout for login shells. */ /* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
so if red hat builds bash based on the source as it is, then that variable is still commented out and the man page is misleading. thoughts?
rday
On 03/05/18 19:49, Robert P. J. Day wrote:
so if red hat builds bash based on the source as it is, then that variable is still commented out and the man page is misleading. thoughts?
Both ~/.bash_logout and /etc/bash.bash_logout are honored on my F27 system.
[egreshko@meimei ~]$ !ssh ssh 192.168.1.107 egreshko@192.168.1.107's password: Last login: Mon Mar 5 19:59:43 2018 from 192.168.1.18
[egreshko@f27gq ~]$ ls /tmp/me /tmp/universal ls: cannot access '/tmp/me': No such file or directory ls: cannot access '/tmp/universal': No such file or directory
[egreshko@f27gq ~]$ cat .bash_logout # ~/.bash_logout
touch /tmp/me [egreshko@f27gq ~]$ cat /etc/bash.bash_logout #!/bin/sh
touch /tmp/universal
[egreshko@f27gq ~]$ exit logout Connection to 192.168.1.107 closed. [egreshko@meimei ~]$ ssh 192.168.1.107 egreshko@192.168.1.107's password: Last login: Mon Mar 5 20:00:29 2018 from 192.168.1.18
[egreshko@f27gq ~]$ ll /tmp/me /tmp/universal -rw-rw-r--. 1 egreshko egreshko 0 Mar 5 20:01 /tmp/me -rw-rw-r--. 1 egreshko egreshko 0 Mar 5 20:01 /tmp/universal
On Mon, 5 Mar 2018, Ed Greshko wrote:
On 03/05/18 19:49, Robert P. J. Day wrote:
so if red hat builds bash based on the source as it is, then that variable is still commented out and the man page is misleading. thoughts?
Both ~/.bash_logout and /etc/bash.bash_logout are honored on my F27 system.
i take it back, you're right, not sure what i did wrong with my test.
rday
On 03/05/18 20:10, Robert P. J. Day wrote:
On Mon, 5 Mar 2018, Ed Greshko wrote:
On 03/05/18 19:49, Robert P. J. Day wrote:
so if red hat builds bash based on the source as it is, then that variable is still commented out and the man page is misleading. thoughts?
Both ~/.bash_logout and /etc/bash.bash_logout are honored on my F27 system.
i take it back, you're right, not sure what i did wrong with my test.
Probably you were testing with a shell that wasn't a login shell.