mirror of
https://github.com/mr0xb/scripts.git
synced 2026-08-27 19:34:57 -04:00
add old scripts
This commit is contained in:
parent
1c58245cc5
commit
9c1772908b
18 changed files with 338 additions and 0 deletions
33
util/newnote
Executable file
33
util/newnote
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Temporary scratchpad that saves only if you choose to keep the note
|
||||
|
||||
SCRATCHDIR="$HOME/Documents/notes"
|
||||
mkdir -p "$SCRATCHDIR"
|
||||
|
||||
TMPFILE="$(mktemp)"
|
||||
vim "$TMPFILE"
|
||||
|
||||
# If file is empty, discard automatically
|
||||
if [[ ! -s "$TMPFILE" ]]; then
|
||||
echo "🧹 Scratchpad empty — discarded."
|
||||
rm -f "$TMPFILE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "📝 Scratchpad contents:"
|
||||
echo "----------------------------------"
|
||||
cat "$TMPFILE"
|
||||
echo "----------------------------------"
|
||||
|
||||
read -p "Save this note? (y/N): " answer
|
||||
|
||||
if [[ $answer =~ ^[Yy]$ ]]; then
|
||||
OUTFILE="$SCRATCHDIR/note-$(date '+%Y-%m-%d_%H-%M-%S').txt"
|
||||
mv "$TMPFILE" "$OUTFILE"
|
||||
echo "✅ Saved to: $OUTFILE"
|
||||
else
|
||||
rm -f "$TMPFILE"
|
||||
echo "❌ Discarded."
|
||||
fi
|
||||
|
||||
Loading…
Reference in a new issue