1

I am working with a script which automatically enrolls macOS devices (installs software, sets up system preferences etc.) using Jamf. While the script is running, I want a real-time log to appear on the desktop for the administrator to check progress etc.

Using the SE search I could only find logging to files after script was finished.

Q: how do I add real-time logging to a text-file on the desktop into my bash script?

LWun
  • 11
  • 2
  • 3
    Does this answer your question? [Using exec and tee to redirect logs to stdout and a log file in the same time](https://unix.stackexchange.com/questions/145651/using-exec-and-tee-to-redirect-logs-to-stdout-and-a-log-file-in-the-same-time). See also https://stackoverflow.com/questions/25833676/redirect-echo-output-in-shell-script-to-logfile – pLumo Mar 02 '21 at 11:58
  • `myscript | tee file.log` – Pavel Apr 29 '23 at 01:55

1 Answers1

1

Have you heard of tee which sends stdin to stdout and a logfile. Your command need only send to stdout which you can pipe into tee.

X Tian
  • 10,413
  • 2
  • 33
  • 48