linuxbashthunar

Escaping characters in bash


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


Solution

  • Seems like Thunar replaces %F with (potentially multiple) correctly quoted paths. Putting this inside quotes will ruin the already perfect quoting. From https://docs.xfce.org/xfce/thunar/custom-actions

    Never quote field codes

    You need a way to pass an argument list to a command running inside xfce4-terminal. Luckily man xfce4-terminal lists:

    -x, --execute Execute the remainder of the command line inside the terminal

    Therefore, try

    xfce4-terminal --hold -x md5sum %F