shell + escaping = confusion


    Jul 18 2007 | 2:33 pm
    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:
    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

    • Jul 18 2007 | 7:13 pm
      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
      >
      ----------------------------------------------------
    • Jul 19 2007 | 8:33 am
      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)