summaryrefslogtreecommitdiff
path: root/bashrc
diff options
context:
space:
mode:
authorjohannst <stoelp@eit.uni-kl.de>2018-04-06 16:45:15 +0900
committerjohannst <stoelp@eit.uni-kl.de>2018-04-06 16:45:15 +0900
commit73a55130911dcde9d43ceb3be713d88fe50f8769 (patch)
treebd94936682ab4caa038053b3dc4e04a5f142d36f /bashrc
parente8be0f72346477aa267ed59db02d6b7aa031f8dc (diff)
downloaddotfiles-73a55130911dcde9d43ceb3be713d88fe50f8769.tar.gz
dotfiles-73a55130911dcde9d43ceb3be713d88fe50f8769.zip
bashrc added save/restore functions
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc25
1 files changed, 25 insertions, 0 deletions
diff --git a/bashrc b/bashrc
index ca583ec..f1987d0 100644
--- a/bashrc
+++ b/bashrc
@@ -166,3 +166,28 @@ function perr() {
}
#}}}
+#{{{ save/restore settings
+
+function save_bash_options() {
+ local backup_file=$1
+ set +o >> $backup_file
+}
+
+function save_bash_exports() {
+ local backup_file=$1
+ export -p >> $backup_file
+}
+
+function save_bash() {
+ local backup=${1:-~/.saved_bash_env}
+ :> $backup
+ save_bash_options $backup
+ save_bash_exports $backup
+}
+
+function restore_bash() {
+ local backup=${1:-~/.saved_bash_env}
+ source $backup
+}
+
+#}}}