summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
+}
+
+#}}}