Between digression and ingression got completely lost. Couldn't see the wood for the trees. Still can't.
Sorry, it's complex, and seems I not realized what I could have been left out... I try again, hopefully this time I manage better. (I also removed quite some unneeded text in my above post)
You can boil it down to this:
I want to call mc (via a script) with 2 paths. So that mc opens these "target path" in its left and right working panel, one is the source directory for backup copy, the other the target. The target directory in /tmp varies since I give it a name including version and date so that I can have several versions next to each other.
Both have whitespace. One also has a wildcard. (The one in /tmp)
The path with only whitespace you can enclose in " ". (In my example, the one in /home/rava, but could be anywhere with a needed path with whitespace)
The other one, you cannot use " " to protect the whitespaces, or else the wildcard * won't expand.
Code: Select all
# file /tmp/999-local-settings-3.1.*/home/rava/.moonchild\ productions/pale\ moon
That's an how it works fine in bash itself, but not in a bash script. When you created a matching folder, e.g.
Code: Select all
# mkdir -p "/tmp/999-local-settings-3.1.0_2016-04-17/home/rava/.moonchild productions/pale moon"
the above would match, like I demonstrated with bash in my above post.
But when you try the same in a bash script, it fails. You get an "file or folder not found", or such error.
Like I said above, using " " won't work, since the * won't expand.
Using "\ " (minus the " ) also not works, the bash script complains about "path not found", even when the same works fine in bash itself....
That's boiled down to the basics. Well, at least I found a 2 part work around as quoted above, but I would prefer a solution in being able to give such wildcard and whitespace folder or filename and the script is able to expand the wildcard(s) while still respecting the whitespaces.