Ultimately I'm trying to catch some errors that are popping up but aren't getting returned.
Here's the command I'm trying to run.
/usr/bin/dscl . -change /Users/admin NFSHomeDirectory /Users/admin /var/admin
when it runs successfully it returns \n when it comes up with an error I get \n and
<main> attribute status: eDSAttributeNotFound
<dscl_cmd> DS Error: -13134 (eDSAttributeNotFound)
I know why I'm getting the error and I'm actually making it happen intentionally so that I can (hopefully) get terminal to write the next two lines out to a file or (eventually) send it using CURL to another computer.
So when I run the command with either > tomytextfile.txt it writes and empty file or using my POST request like so
echo "result=`/usr/bin/dscl . -change /Users/admin NFSHomeDirectory /Users/admin /var/admin`" | curl --data-urlencode result@- http://172.16.26.251:8080/script
I get this as the response on the server where I'm sending the curl POST request.
{ result: 'result=\n' }
If anyone has any ideas, I'd be super grateful.