System.util.execute and echo to file

Hello everyone,
I am trying to use the system.util.execute() function to create some log files on the ubuntu host OS.
Anyone know how to make the magic work with this simple shell command:

echo "Some text for my log file" > testfile.log

In Ignition the following is not working:

system.util.execute(["echo","Some text for my log file",'>',path+"/testfile.log"])

even though I have tried multiple variants of that one. I suspect im having problems with the > operator. I also need this one for my next execute command which is also not working:


Thanks for reading this!

You're mixing up shell commands with what are supposed to be program arguments.

Easiest thing to do would be to stick these into a shell script and execute that script.

Otherwise you'll want to play with some variation that looks like (untested):

system.util.execute(["/bin/sh", "-c", "git -C ... full command here"])

You also need to keep in mind the scope in which you're executing this. If you're using the Designer Script Console, for example, it's executing wherever the Designer is running.