The attached macro runs Terminal to delete files in Downloads (chess games I've played). It quits the Terminal but fails to delete the files. If I remove the Quit action, the files are deleted, but the Terminal window remains open. I haven't found a way to make both actions execute.
Try using an "Execute Shell Script" action instead, putting your command in that -- the macro will then delay until the script step completes which (unless you've set it to "asynchronous") will be after the file deletion has completed:
Also worth noting that the "Delete File" action has a "Delete" option which similarly completely deletes a file without warnings and without using the Trash. So you could keep the whole process within KM, without the "Execute Shell Script" step, by creating a file Collection then doing For Each on that.
Well, my suggestion was based on the usual operation of the command line (terminal) where a command needs to be followed by a return for it to be acted upon. If there is something else happening then perhaps someone else can explain.
Anyone can respond to any post at any time provided the thread has not been locked - and this discussion is most certainly not locked!
In which case you already have a return character at the end of what your macro is typing into terminal. To make sure I’m wrong about this, please can you post the actual macro that works (I.e. without the Quit) so I can have a look?
I do sometimes find myself wishing KM text boxes had the equivalent of "Show invisibles", to make these things easier to spot...
Nice that the problem is solved, but I'd still urge you to do this as an "Execute Script" action instead of within Terminal -- you'll get rid of the needless pauses and remove the chance (however slim, in this case) of Terminal being told to Quit before your command has completed. As an example, try the following (don't worry, du is totally non-destructive, we're simply trying to get the disk space used by your home folder):
As shown earlier, it's the "Execute a Shell Script" action.
You already know enough to do what you need -- you're typing it into Terminal!
"Execute a Shell Script" is almost the same as as "Launch Terminal, type in the command, remember to press the Return key, wait for the command to complete, Quit Terminal". The action defaults to using the bash shell while you are probably using zsh in Terminal, the "shell environment" will be slightly different, and it's less easy to interact with the command (eg to type in a password), but most of these differences can be overcome. And most of the time they aren't important -- commands provided with your OS (rm, ls, and a whole host more) run the same regardless. It's only when you start installing your own packages that things like $PATH matter, and if you're doing that you probably know enough to cope.
The benefits are that you don't have to launch and manipulate another application, don't have to mess with "Pause" actions, don't have to deploy fancy "wait" conditions to make sure the process completes before your macro continues, that you can use the results of the shell command later in the macro, and probably more!
If you are already using a shell via Terminal it's a very short step to using the "Execute a Shell Script" action in KM, and you'll open up a world of possibilities...