What is the best practice when running external utilities in shell scripts. For example if I want to run 'gzip' in multiple scripts ensuring that a specific gzip binary is used should I make the full path to the binary a variable and just use the variable thoughout the script?
GZIP=/home/me/bin/gzip
$GZIP somefile
$GZIP anotherfile
Or is it better practice to hard code the path for each call to the binary?
/home/me/bin/gzip somefile
/home/me/bin/gzip anotherfile
Or is it better to set and rely on the path?
PATH=/home/me/bin:$PATH
gzip somefile
gzip anotherfile
I'm not running the scripts as root therefore maintainability, and portability is more important than user security.