``` #!/usr/bin/env bash PIPE=pipe mkfifo $PIPE # both journal and file if false; then systemd-cat -t test-for-nixos < $PIPE & exec 3>$PIPE exec &> >(tee -a $PIPE log) exec 2>&1 # journal only elif false; then systemd-cat -t test-for-nixos < $PIPE & exec &>$PIPE exec 2>&1 # file only else exec 3>&- exec >>log exec 2>&1 fi echo this is stdout >> /dev/stdout echo this is stderr >> /dev/stderr exec 3>&- ```