Hy,
I am trying to handle white spaces and special characters like "&" in a shell script which is supposed to set custom directory icons using gio in Ubuntu 18.04.
When directory names consist only of a single word eg. MyFolder the following script works just fine:
for dir in $(find "$PWD" -type d); do
icon="/.FolderIcon.png"
iconLocation="$dir$icon"
if [ -a "$iconLocation" ]; then
front="file://"
gio set "$dir" metadata::custom-icon "$front$iconLocation"
fi
done
However when the directory is named eg. "A & B" the above script does not change the icon of the respective directory.
So my question is: Is there a way to handle directories named like "A & B" in my script?
Thanks to the answer of Paul Hodges the following solution finally worked for me: