Get file name with command line sensor

I would like to retrieve the name of the latest snapshot file using a command line sensor (to later use that in a cURL call using the restful component).

To do that, I have the following

- platform: command_line
  name: Latest Snapshot Filename
  command: 'ls -t /backup/ | head -n1'

However it does not give me anything. Can anyone help me out?

Nevermind, I created a bash script and used shell_command directly to do everything.