clawdinators/scripts/memory-edit.sh
2026-01-08 13:43:56 +01:00

17 lines
301 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
file="${1:-}"
shift || true
if [ -z "$file" ] || [ "$#" -eq 0 ]; then
echo "Usage: memory-edit /memory/path.md '<command>'" >&2
exit 2
fi
cmd="$*"
if ! flock -x -w 5 "$file" bash -c "$cmd"; then
echo "memory-edit: lock timeout for $file" >&2
exit 1
fi