How do I Execute Shell Script that Requires Arguments?

###How do I Execute Shell Script that Requires Arguments?

I have found a shell script in GitHub that requires arguments. According to the comments in the script, it should be called as follows:

./check_time_machine_currency.sh -w 240 -c 1440

My preference would be too put the script code in a KM Execute Shell Script Action, as TEXT. But when I run the script I get an error that

You must provide a warning threshold

I also tried saving the script to a file, and then use the “Execute script file” like this:
/Users/Shared/Dropbox/SW/DEV/KM/AppleScripts/check_time_machine-currency.sh -w 240 -c 1440

That results in Execute Shell Script Exception

The script is here:
GitHub file check_time_machine_currency.sh

Thanks.

P.S. I know almost nothing about shell scripts, so this is likely a “user error” :astonished:

“Execute text script” (not “Execute script file”):

Tom

1 Like

…And to execute it inline you can use Keyboard Maestro variables:

Note that you have to replace spaces in KM variables in the script with underscores.

[Test] TM Script.kmmacros (5.8 KB)

1 Like

Thanks @Tom. Those were both very helpful suggestions.

1 Like