Executing the following script from the Nautilus "Scripts" right-click menu option with a filename that contains a percent sign removes the percent sign and the next character from the filename. E.g., if the file is called uvw10%xyz, the script will print uvw10yz to the file abc.txt.
#!/bin/bash echo "$1" >> abc.txt
Any character, even a space, can follow the percent sign and the problem remains. And I realize it works from the terminal; that's not the question. The point is that it doesn't work when run as a Nautilus script.
What's going on here? How can I fix it?
Apparently, the correct filenames can be printed like this:
while read line; do [ "$line" ] && echo "$line" done <<< "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" > abc.txt
But I would still like to know what's happening with the precent sign in the original code.