put everything in a subshell

This commit is contained in:
slonkazoid 2024-12-26 20:14:12 +03:00
parent 70d035c410
commit 9cb637facd
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM

10
blag
View file

@ -86,18 +86,16 @@ codeblock() {
printf '</code></pre>' printf '</code></pre>'
} }
render() { render() {(
local birth=$(stat -c'%W' "$1") birth=$(stat -c'%W' "$1")
if (( birth > 0 )); then if (( birth > 0 )); then
CREATED_AT=$(date --rfc-3339=seconds -d "@$birth") CREATED_AT=$(date --rfc-3339=seconds -d "@$birth")
fi fi
MODIFIED_AT=$(date --rfc-3339=seconds -d "@$(stat -c '%Y' "$1")") MODIFIED_AT=$(date --rfc-3339=seconds -d "@$(stat -c '%Y' "$1")")
#shellcheck disable=SC1090 #shellcheck disable=SC1090
( . "$1"; ) # the moment you've all been waiting for . "$1"
} )}
print_help() { print_help() {
echo "Usage: $0 <SCRIPT> echo "Usage: $0 <SCRIPT>