From bbf21d3b21f91896c5f2ffc468f3c693dbb86755 Mon Sep 17 00:00:00 2001 From: Robert Morrison Date: Sun, 20 Feb 2022 00:11:49 +0000 Subject: [PATCH] Functionify my tempPersist script --- functions/tempPersist | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 functions/tempPersist diff --git a/functions/tempPersist b/functions/tempPersist new file mode 100644 index 0000000..f59b8de --- /dev/null +++ b/functions/tempPersist @@ -0,0 +1,25 @@ +tempPersist() { + ARG=$1 + + if [ $# -eq 0 ]; then + if [[ -f ~/tmp/KEEPTMP ]]; then + echo "Temp is persistent" + else + echo "Temp will be Deleted" + fi + else + if [[ $ARG = "on" ]]; then + touch ~/tmp/KEEPTMP + echo "Temp is persistent" + elif [[ $ARG = "off" ]]; then + if [[ -f ~/tmp/KEEPTMP ]]; then + rm ~/tmp/KEEPTMP + fi + echo "Temp will be Deleted" + else + echo "on or off only" + fi + fi + +} +# vim: set ft=zsh ts=8 sw=4 tw=0 noet :