One way to solve your problem is to set IFS to explicitly cause files to
be split on newlines, as below. For an explanation of how this works,
see the bash man page. Similar functionality exists in sh and zsh (and
probably the csh-derived shells as well).

#!/bin/bash
IFS=$'\n'
for file in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
do
 zenity --info --text "$(md5sum $file)"
done

Although quoting in shell scripts is frustrating and obtuse, the
behavior you experienced is not a bug. I recommend closing as not-a-bug.

The only misfeature here is that \n is technically legal in filenames;
\0 would have been preferable.


I can't resist. Here's a great way to impress people at dinner parties and wow 
chicks:
#!/bin/bash
IFS=$'\n'
zenity --list --column md5 --column file $(find 
${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS} -type f -print0 | xargs -0r md5sum | 
perl -pe 's/^(\S+)\s\s/$1\n/')

-Reece

-- 
Nautilus-scripts don't handle blanks in filenames properly
https://bugs.launchpad.net/bugs/95519
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to