Escaping characters in bash

hey guys

  • I use thunar as a file manager
  • I want to use “custom actions” on certain files (Thunar → Edit → Configure Custom Actions…)
  • the command I use is: xfce4-terminal -e "md5sum '%F'" --hold

This works fine, except when the file path or file name contains a space. It just won’t work as intended because the file can then not be found.

I think this is because the spaces in the file path are not automatically escaped

How do I solve this problem?
Thank you in advance

I also use custom actions with %f (for a single file), and i don’t recall having such issue. Though escaping might be done by surrounding the path with double-quotes, in which case those might “disable” the ones you put in your command.
You could try using single quotes instead:

xfce4-terminal -e 'md5sum %F' --hold

Or, perhaps

xfce4-terminal -e 'md5sum "%F"' --hold

But I’m no expert, so might be completely wrong.

:man_shrugging: