Embarrassingly, I'm back for help on the same script I posted. I tested it on filenames and paths without whitespaces. But now when I try it on any such files with whitespaces, it doesn't work!
How do I insert quotations around those folders / filenames with whitespaces when the entire block of them are passed in the positional parameter?
So let's say above I escape and quote the entire parameter:
Code:
exiftool -P -overwrite_original -$metafield=$metadata \"$@\"
and $@ represents like 5 jpg files, 1 through 5, the result is "1.jpg 2.jpg 3.jpg 4.jpg 5.jpg", rather than "1.jpg" "2.jpg" "3.jpg "4.jpg "5.jpg"
This script works in bash, so I think the issue is a Nemo one. The Nemo action script looks, in relevant part, like:
Code:
Exec=/home/me/.local/share/nemo/scripts/exif_edit.sh %F
so you see %F is passing all selected files.
Is there some method of substitution I can perform in the script so that it ignores or substitutes the whitespaces for purposes of processing them?
All I can think of is performing some sed or awk to find all patterns in $@ that start with "/home" and end with ".[jpg|gif|png|doc]" etc., place each matching pattern into an array, and then iteratively process each of these using the above exiftool command. Would something like this be a viable solution?
Thanks!