#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
WORK="$ROOT/outputs/linux/linux-files"
mkdir -p -- "$WORK"
TMP_DIR="$(mktemp -d "$WORK/tmp.XXXXXX")"
cleanup() { case "$TMP_DIR" in "$WORK"/tmp.*) rm -rf -- "$TMP_DIR";; *) return 1;; esac; }
trap cleanup EXIT
mkdir -p -- "$TMP_DIR/sample files"
printf '%s\n' 'hello data' > "$TMP_DIR/sample files/note.txt"
cp -- "$TMP_DIR/sample files/note.txt" "$TMP_DIR/sample files/copy.txt"
mv -- "$TMP_DIR/sample files/copy.txt" "$TMP_DIR/sample files/renamed.txt"
printf 'file contents: '
cat -- "$TMP_DIR/sample files/renamed.txt"
printf 'bytes: '
wc -c < "$TMP_DIR/sample files/note.txt"
test -f "$TMP_DIR/sample files/renamed.txt"
