Trim off the history number when getting the command.

This should also filter the initial 'trap' command. The change in
Daemon.hs is to prevent a case where the pipeline would stop after
filtering something, because 'unless' was being applied too widely.