#!/bin/bash
TMPFILE="$(mktemp)"
for f in "$(dirname "$0")/"*".txt"; do
	cat "$f" | tr -d '\n' > "$TMPFILE"
	mv "$TMPFILE" "$f"
done
rm "$TMPFILE"


#!/bin/bash
TMPFILE="$(mktemp)"
for f in "$(dirname "$0")/"*".txt"; do
	cat "$f" | tr -d '\n' > "$TMPFILE"
	mv "$TMPFILE" "$f"
done
[ -e "$TMPFILE" ] && rm "$TMPFILE"


Remove temp file only if it exists
Remove temp file only if it exists
