Adding Line Breaks to Logs. \n doesn't work

axnessj
New Contributor

Does anyone know how have policy logs use line breaks or returns? No matter what I try adding , \n, and <br> to my echo -e's JSS insists I read it in paragraph form. I want my logs to look like this

<timestamp> Return 1...
<timestamp> Return 2...
<timestamp> Return 3...

Instead it forces me to view it like this

Script result: Tue Nov 19 14:56:10 CST 2013: Skipping User Shared folder. rm: /Users/redacted/Library/Preferences/ByHost/com.apple.loginwindow.: No such file or directory Tue Nov 19 14:56:10 CST 2013: Removed any AutoLaunch Applications rm: /Users/redacted/Library/Preferences/ByHost/com.apple.loginwindow.: No such file or directory Tue Nov 19 14:56:10 CST 2013: Removed any AutoLaunch Applications Tue Nov 19 14:56:10 CST 2013: Wireless is powered on.. better turn it off., Tue Nov 19 14:56:10 CST 2013: Turning off the Wireless for OS X 10.8...

5 REPLIES 5

mm2270
Legendary Contributor III

What JSS version? I don't think we've experienced this problem. But then, are you echoing out information one per line, or are you trying to echo out the results all at once?
Also, where are you reading the logs from? The JSS? Or from a log file on the target Mac?

m_entholzner
Contributor III
Contributor III

Just use printf instead of echo, then will work.

axnessj
New Contributor

We are using JSS 9.12. Each echo is on a different step in the script. I am viewing the logs from JSS in the Inventory > TestComputer > History > Policy Logs

I replaced all the echo -e with printf and the output is still in paragraph form. Looks like this still:

Executing Policy Startup Test 2...

Running script StartupScript-AllOSX.sh...

Script exit code: 0

Script result: Timestamp is: Wed Nov 20 08:37:51 CST 2013 Wed Nov 20 08:37:51 CST 2013: Skipping User Shared folder. rm: /Users/redacted/Library/Preferences/ByHost/com.apple.loginwindow.*: No such file or directory Wed Nov 20 08:37:51 CST 2013: Removed any AutoLaunch Applications Wed Nov 20 08:37:51 CST 2013: Removed any AutoLaunch Applications Wed Nov 20 08:37:52 CST 2013: Wireless is powered on.. better turn it off., Wed Nov 20 08:37:52 CST 2013: Turning off the Wireless for OS X 10.8...

mm2270
Legendary Contributor III

So shortly after you posted this topic, this FR was posted. So it looks like its an issue in Casper Suite 9. That would be why i haven't seen it. We're still only testing version 9.
https://jamfnation.jamfsoftware.com/featureRequest.html?id=1670

luke_reagor
Contributor II

It's still an issue as of 10.15.1.
Here's the FR for it: https://www.jamf.com/jamf-nation/feature-requests/6993/correctly-display-line-breaks-in-policy-logs