Posted on 06-04-2019 12:40 PM
Noob scripting question. When using a script to edit a plist, what's the difference between:
/usr/bin/defaults write ........
and just doing
defaults write........
Posted on 06-04-2019 12:46 PM
You are specifying the full path of the command with /usr/bin/defaults. This is more desirable as you might get mixed results with some commands when running in different contexts, like Daemons etc.
You can find the full path of a command by: which defaults
or command -v defaults
.
Posted on 06-04-2019 12:52 PM
@ryan.ball Thanks. I had seem some scripts written with it and some without and couldn't distinguish why. That makes sense.
Posted on 06-04-2019 09:21 PM
Using the full path to a command, which is really just a file, is a security measure. This ensures the defaults
command you want to run is this one located at /usr/bin/defaults
and not this one at ~/Library/.hidden/malicious/keylogger/defaults
.