do shell script contine script but log result

I want to run a schell script and send the result to a file but I don’t want the applescript to wait for the shell script to finish. I currently am using this:

do shell script “command >> file_path” but the applescript waits until the command is finished.

I’ve found the Technical Note from Apple: about how to do this. They suggest:

do shell script “command &> file_path &”

The problem is that file_path is re-written every time, instead of the output being logged to the end of file_path.

I’ve tried variations such as:
do shell script “command &>> file_path” and
do shell script “command >> file_path &”
these do not work, and I do not know enough about shell scripting. I also tried to surround the do shell script command with an ignoring application responses, but that does not work because the command I’m using is “with administrator privileges”. The applescript does not ask for a password and the command will not work.

Does anyone know how to both allow the applescript to contine and log the output of the script command to the end of a file?


I use this for listing the contents of large folders or small disks:

do shell script “ls ~/Desktop/SomeFolder/ >> ~/Desktop/SomeFolderContents”

The key is that you are putting the standard output into the file indicated. If you’re not getting anything from:

do shell script “yourCommand >> SomePath” then yourCommand doesn’t have any output as you’ve configured it.


That is essentially what I am doing. I do get standard output to the file, that is not the problem. The problem is that the applescript waits until the do shell script command is completed. I want the applescript to contine without waiting for the command to be completed. The Apple tech note explains how to do this, but instead of the standard output being appended to the end of the file, it re-writes the file. I want the standard output to be appended to the end of the file.



Thanks that works great!

One question though. Does this send both standard output and error to the file, or do the errors go to null?