A program runs when called by its full path but fails with "command not found" when called by name, which means its dir…