Some shell script programmers use absolute paths for even common system tools:
/bin/sed '/^$/d' data
This command line is intended to print the contents of the data file, but to skip blank lines. It does work on most GNU/Linux systems, but why specify the full /bin/sed path? Why not just sed?
Worse, sometimes people try to abbreviate this by saving the full paths in variables, after retrieving them with a non-standard tool such as which:
# Terrible code; never do this! SED=$(which sed) $SED '/^$d/' data
Can you see anything else wrong with this code? Hint: what was the very first thing we re-emphasized in this chapter?
This use of which and full paths such as this is unnecessary, and there are no advantages to doing it. Bash will already search PATH for you for any command name; you don't need to rely on which (or even type...