As @GordonDavisson suggests, you can view your path using echo $PATH.
To change your applescript's path (and view the change) try this:
do shell script "export PATH=/usr/local/bin:$PATH ; echo $PATH"
The first part of the shell command (up to the semi-colon) will prepend /usr/local/bin to your default path. The second part will return your updated path. The semi-colon has the second part run after the first part is finished.
It's important to note that this change is temporary and only in effect for this shell script and only while it is operating. This is why you need the combined commands in order to see the effect.
I'll use 'rsync' as an example since I don't have rclone; substitute 'rclone' to get its path. To get its path, you combine the export command with which, like so:
do shell script "export PATH=/usr/local/bin:$PATH ; which rsync"
The result is /usr/local/bin/rsync.
To clarify a couple of things… the environment is a set of conditions that apply for each user. You can get a basic rundown of it by running man 7 environ in Terminal. There is an env command which lists your settings and allows you to edit them; man env will provide info on it. At the bottom of these man pages, you should see references to related commands which you can also look up. Meanwhile, from within Script Editor, you could run a 1-line script with do shell script "env" and see the corresponding environment for applescript's shell.
Based on Apple's documentation (or my interpretation of it), they chose this setup because it is relatively secure and portable. You know what you get every time you run a shell script. You don't need to use a more modern shell to run the which command. You can modify the environment as needed, the same way you would while using the terminal.
Finally, Apple has provided Technical Note 2065 which provides info on using shell scripts with applescript. Also, you can likely get more info here or on the unix stack exchange.
NB All of the above is just my understanding, which is limited.
whichwon't help here, because it searches for the command in the same places that the shell would if you just used the command name directly. Specifically, bothwhichand the shell search the directories listed in thePATHenvironment variable.do shell scriptruns its commands with a pretty basic environment, so neither will be able to find it without a full path.which rcloneinto terminal, no matter my path, it works. But not in the AppleScript, which you’ve explained is due to its environment (which I don’t fully understand, I’m a hobbyist at this, not a pro). So how would I find the path to rclone using AppleScript? I am hoping to give this script to a few friends and colleagues, but we all run different versions of macOS. So I want to make sure the path to rclone is found and correct. The rest of this should work fine.PATHis different from your working path. You can check its value in your interactive shell withecho "$PATH". It's a colon-delimited list of directories to search for executables, and you'll see that it includes/usr/local/binas one of the entries. Now open Script Editor and try running the AppleScriptdo shell script "echo \"$PATH\""and you'll see that it doesn't include that directory. The difference is because your interactive shells run several setup scripts that (among other things) add more entries to the shell'sPATH. I don't know the best way to do this from AppleScript.do shell script "export PATH=/usr/local/bin:$PATH ; echo $PATH"which will prepend usrlocalbin to the path, and then echo the updated path. Note that this edit will vanish once the shell script is finished. So you need to combine the commands, like so:do shell script "export PATH=/usr/local/bin:$PATH ; which rsync". I use rsync because I don't have rclone installed. The result is"/usr/local/bin/rsync"do shell scriptdoesn't have the directory ofrcloneon itsPATH, possibly because it's a very basic shell. You could try to run a more modern shell that may havercloneon itsPATH. I would trydo shell script "zsh -c 'which date'"