0

I have the following script:

#!/usr/bin/env sh

set -x
(
    echo "Running command ls -la" && \
    cd folder/path && \
    ls -la
) $>> some_file 2>&1 &

Pretty much I tried mixing two answers I saw but I always ended up with truncating the file or not getting a right syntax:

How do I save terminal output to a file?

https://unix.stackexchange.com/questions/74520/can-i-redirect-output-to-a-log-file-and-background-a-process-at-the-same-time

Instead of just following pre-made recipes maybe it is best to understand what those symbols actually mean to be honest

I run the commands inside () because there are some environment variables that I need to set on my actual command and I only want those to be set for that command to run

Murilo
  • 141

0 Answers0