This commit is contained in:
2025-03-19 16:50:37 +01:00
parent 39b2824204
commit a06f790edb

View File

@@ -0,0 +1,18 @@
edex() {
local fname="$(mktemp)"
cat >"$fname"
local epoch="$(mktemp)"
trap 'rm "$epoch" >&/dev/null' RETURN ERR
"$EDITOR" "$fname" >&2 || return 1
# check mtime to ensure the editor has saved
if [[ -s "$fname" && "$fname" -nt "$epoch" ]]; then
# history -s ". $(printf "%q" "$fname")"
printf >&2 "edex: commands are save to %q\n" "$fname"
. "$fname"
else
printf >&2 "%s\n" "edex: File not saved, hence not run"
return 1
fi
}