BackupPC has two configuration variables:
$Conf{PingPath} = '/bin/ping';
Full path to the ping command.
$Conf{PingCmd} = '$pingPath -c 1 $host';
Ping command. The following variables are substituted at run-time:
$pingPath path to ping ($Conf{PingPath})
$host host name
I'm just trying to understand why there are two separate variables. That is, what benefit does this setup provide as opposed to just a single variable
$Conf{PingCmd} = '/bin/ping -c 1 $host';
To me that looks like an improvement iteration where somebody ran into portability issues with
ping
either not installed in the default$PATH
or not in/bin/
and then deciding to make the absolute path toping
a configurable parameter, which would only need updating in one place.Creating a new parameter when that parameter will be referenced only once, that may seem a bit redundant, but maybe that wasn't known beforehand or it is simply a (personal) coding style preference.
Since parameter expansion/substitution is cheap doing that is not harmful.