Executing shell commands

I’m trying to run an executable file as follows:

void setup()
{
  noLoop();
}
void draw()
{
  launch("/usr/bin/gpsbabel");
  launch("/usr/bin/gpsbabel -i gpx -f /home/phil/Downloads/test3.gpx -o garmin -F /dev/ttyUSB0");
}

The first launch() results in:

“The file file:///usr/bin/gpsbabel is an executable program. For safety it will not be started.”

The second Launch() results in:

“Unable to run the command specified. The file or folder /usr/bin/gpsbabel -i gpx -f /home/phil/Downloads/test3.gpx -o garmin -F /dev/ttyUSB0 does not exist.”

I’ve also tried exec() instead of launch() and the result is an exception error in the second instance. I think exec() is what I need.

I’ve also tried the same thing in Python and end up with the same “file does not exist” error so I’m supposing there is something wrong with the formatting of the command. The command does execute without error from the command line.

I’m sorry to ask, but I need some hand-holding here.

Maybe try out w/ "bash -c " like in this example: :man_shrugging:

However, it has never been tested under Linux yet! :penguin:

Thank you for your reply GoToLoop,

I added "static final String BASH = platform == WINDOWS? "cmd /C " : "bash -c “;” before setup() without understanding what’s going on and, unsurprisingly, it didn’t help.

I think I’ll have to find a ready made programme to upload a batch of way points.