From f9ed01397cfead24badbcd4b61a74bac5238e1d0 Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 12 Aug 2024 17:39:42 +0200 Subject: [PATCH] zsh: functions: add bak/unbak functions --- functions/misc.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/functions/misc.zsh b/functions/misc.zsh index 08c6b59..f62cbbe 100755 --- a/functions/misc.zsh +++ b/functions/misc.zsh @@ -364,7 +364,17 @@ function watch_and_run() { # use watch and force color with grc function watchc() { - watch --differences --interval 1 --color grc --colour=on $@ + watch --differences --interval 1 --color grc --colour=on $@ +} + +# make a backup copy of the argument adding the .bak suffix +function bak() { + cp $1{,.bak} +} + +# restore a backup copy created using `bak` +function unbak() { + mv $1{.bak,} } # highlight functions with when calling which