shell + escaping = confusion

Jul 18, 2007 at 2:33pm

shell + escaping = confusion

Hi all, once again an attempt to create a folder containing spaces with shell.. running into weeirrd things here. The following patch is probably self-explanationary:

– save as ‘conform.js;:

function conform(v)
{
var splitString = v.split(” “);
var newPath = splitString.join(“\\ “);
outlet(0, newPath);
}

save as anyhing:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 505 80 100 196617 works;
#P message 358 99 133 196617 conform “./ding dong dang”;
#P newex 358 117 71 196617 js conform.js;
#P newex 505 209 74 196617 prepend mkdir;
#P newex 505 229 31 196617 shell;
#P newex 505 137 27 196617 t b l;
#P message 505 180 136 196617 “./ding\\ dong\\ dang”;
#P newex 522 158 62 196617 prepend set;
#P message 505 99 133 196617 conform “./ding dong dang”;
#P newex 505 117 71 196617 js conform.js;
#P comment 358 80 100 196617 doesn’t work;
#P connect 2 0 1 0;
#P connect 1 0 5 0;
#P connect 9 0 8 0;
#P fasten 8 0 7 0 363 202 510 202;
#P connect 7 0 6 0;
#P connect 4 0 7 0;
#P connect 5 0 4 0;
#P connect 5 1 3 0;
#P connect 3 0 4 0;
#P window clipboard copycount 11;

If there is a unix/regexp/shell/OS guru on this forum that immediately sees what’s going on here, I’d appreciate your input.

Cheers,
Mattijs

#32936
Jul 18, 2007 at 7:13pm

Quote: Mattijs wrote on Wed, 18 July 2007 16:33
—————————————————-

No need to double-quote the folder name you want to create:

(mkdir ~/Desktop/Super\ Folder) -> [shell]

Cheers ;-)
PG

> Hi all, once again an attempt to create a folder containing
> spaces with shell.. running into weeirrd things here.
> The following patch is probably self-explanationary:
>
>
> — save as ‘conform.js;:
>
> function conform(v)
> {
> var splitString = v.split(” “);
> var newPath = splitString.join(“\\ “);
> outlet(0, newPath);
> }
>
>
> save as anyhing:
>
> #P window setfont “Sans Serif” 9.;
> #P window linecount 1;
> #P comment 505 80 100 196617 works;
> #P message 358 99 133 196617 conform “./ding dong dang”;
> #P newex 358 117 71 196617 js conform.js;
> #P newex 505 209 74 196617 prepend mkdir;
> #P newex 505 229 31 196617 shell;
> #P newex 505 137 27 196617 t b l;
> #P message 505 180 136 196617 “./ding\\ dong\\ dang”;
> #P newex 522 158 62 196617 prepend set;
> #P message 505 99 133 196617 conform “./ding dong dang”;
> #P newex 505 117 71 196617 js conform.js;
> #P comment 358 80 100 196617 doesn’t work;
> #P connect 2 0 1 0;
> #P connect 1 0 5 0;
> #P connect 9 0 8 0;
> #P fasten 8 0 7 0 363 202 510 202;
> #P connect 7 0 6 0;
> #P connect 4 0 7 0;
> #P connect 5 0 4 0;
> #P connect 5 1 3 0;
> #P connect 3 0 4 0;
> #P window clipboard copycount 11;
>
> If there is a unix/regexp/shell/OS guru on this forum that immediately sees what’s going on here, I’d appreciate your input.
>
> Cheers,
> Mattijs
>
—————————————————-

#109052
Jul 19, 2007 at 8:33am

Quote: Philippe Gruchet wrote on Wed, 18 July 2007 21:13
—————————————————-
> Quote: Mattijs wrote on Wed, 18 July 2007 16:33
> —————————————————-
>
> No need to double-quote the folder name you want to create:
>
> (mkdir ~/Desktop/Super\ Folder) -> [shell]
>
> Cheers ;-)
> PG
> –

Thanks a lot Philippe :)

It’s still strange that setting a messagebox and banging it (which normally shouldn’t result in a change in the original event), has a different effect.

For the archives, this is the modified version, even though now the version with the intermediate messagebox is broken. I find this an interesting inconsistency/unintuitivity..

(javascript remains unchanged)

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 186 190 64 196617 fromsymbol;
#P comment 40 56 100 196617 works;
#P message 39 75 133 196617 conform “./ding dong dang”;
#P newex 39 93 71 196617 js conform.js;
#P newex 186 209 74 196617 prepend mkdir;
#P newex 186 229 31 196617 shell;
#P newex 186 113 27 196617 t b l;
#P message 186 156 136 196617 “./ding\\ dong\\ dang”;
#P newex 203 134 62 196617 prepend set;
#P message 186 75 133 196617 conform “./ding dong dang”;
#P newex 186 93 71 196617 js conform.js;
#P comment 186 56 100 196617 doesn’t work;
#P connect 8 0 11 0;
#P connect 11 0 7 0;
#P connect 4 0 11 0;
#P connect 5 1 3 0;
#P connect 7 0 6 0;
#P connect 3 0 4 0;
#P connect 5 0 4 0;
#P connect 1 0 5 0;
#P connect 2 0 1 0;
#P connect 9 0 8 0;
#P window clipboard copycount 12;

#109053

You must be logged in to reply to this topic.