File tree 3 files changed +16
-18
lines changed
3 files changed +16
-18
lines changed Original file line number Diff line number Diff line change 1
- # Do not put anything in this file; Bash will not read it. Bash would only
2
- # read it if ~/.bash_profile did not exist.
1
+ # STOP! Do not put anything in this file; Bash will not read it. Bash would
2
+ # only read it if ~/.bash_profile did not exist.
Original file line number Diff line number Diff line change 1
- # Copyright 2015 Robin Bate Boerop <[email protected] >
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- # STOP! Do not put code here. It will not do what you think it will.
16
- # Instead, please add code to the exit_trap() function in the bashrc file.
1
+ # STOP! Do not put code here. It will not do what you think. Instead, please
2
+ # use bashrc_d_on_exit() to register a Bash command to be eval'd on exit.
Original file line number Diff line number Diff line change 19
19
export BASHRC_D_BASH_PROFILE_SOURCED=1
20
20
export BASHRC_D_DIR=~ /.bashrc.d
21
21
22
+ bashrc_d_on_exit_commands=()
23
+ bashrc_d_invoke_on_exit_commands () {
24
+ local i
25
+ for i in ${bashrc_d_exit_commands[*]} ; do
26
+ eval $i
27
+ done
28
+ }
29
+ bashrc_d_on_exit () {
30
+ bashrc_d_on_exit_commands+=(" $* " )
31
+ trap bashrc_d_invoke_on_exit_commands EXIT
32
+ }
33
+
22
34
# Bash utility functions upon which the custom scripts can rely, but which
23
35
# can be overridden if desired.
24
36
#
You can’t perform that action at this time.
0 commit comments