fix directory for HEART_COMMAND and quote arguments in PROGNAME
move export declaration for beam vars
use parameter expansion for retrieving PROGNAME