What exactly are the differences between "Execute Shell Script / Task" and "Execute Terminal Command"?

Hi community.

I heavily use shell scripts with BTT though, I'm not sure what exactly are the differences between them:

  • Execute Shell Script / Task
  • Execute Terminal Command (Async / Sync)

Yes, it's obvious that Execute Shell Script / Task is capable of specifying invoking environment like Launch Path, Parameters and etc.
If you are to invoke node, python or ruby - Execute Shell Script / Task is more preferable, I suppose. Or if you want to invoke script on the fly and check the result.

However, in the situation that you simply invoke a script or executing one-liner in sh / bash... I mean, just simple as:

~/bin/foo.sh | bar
# 'foo.sh' has shebang, bar is bin in the PATH that BTT can recognize.

In such case, what's the difference there?

Hi @Andreas_Hegenberg , I assume you're the only one who can tell what the exact difference is, since this is the internal implementation things. When you have a time, could you have a post please?

Thanks.

the execute terminal command is very stupid and just forwards the command as fast as possible to the system. It doesn’t care about the return value, environment variables or anything. If that works for you - use this one.

The run shell task/script is quite powerful because it also allows you to retrieve the return value and use it e.g. on Touch Bar buttons or in the floating HTML view. It is slightly slower than the other command, but not significantly. As you said it offers more options like setting the launch path, easier formatting or providing environment variables

3 Likes

Cool, that makes sense.
Been a BTT user for like 5 or 6 yrs or even more, now it's crystal clear about it at last.
Thank you for your answer!