shell 2013

Aug 12, 2013 at 7:26am

shell 2013

Hi y’all,

Bill Orcutt’s ‘shell’ object has gotten a bit long in the tooth and it was time for a major cleanup and, er, a complete rewrite, actually. An “early beta” is attached to this post, so give ‘er a spin and let me know how it goes.

- complete rewrite :-)
- initial implementation of interactive shell functionality:
  - ‘penter’: if an interactive command is running, send the text + a carriage return
  - ‘pwrite’: if an interactive command is running, send the text (no CR added)
but it’s still pretty rough (“top -s 1 -l 3600 -stats pid\,cpu\,time\,command” works, but can’t be controlled interactively, for instance. I could successfully SSH to another computer, though).
- infrastructure for a Windows CMD version added (but no, there’s not a Windows version yet and may not be for some time).
- new @stderr to optionally merge stderr with stdout

Known issues:
- not really well-tested yet

  • This topic was modified 8 months by  Jeremy Bernstein. Reason: updated attachment
Aug 12, 2013 at 2:43pm

lekker! Thanks, Jeremy!

Aug 13, 2013 at 3:03am

Thanks, thsi is a very useful object. One question though : does that update mean that now you can open an aplication which has no graphical interface ? or a command line application ?

Aug 13, 2013 at 3:06am

You’ll need to provide an example. I’m not quite sure what you want to do.

Aug 13, 2013 at 6:10am

Well anyway it seems to work, previously i could’nt make it work, but error was probably on my side, related more to bad filepath formatting (need \\ inside ” ” for each blank space ; \ is not enough) than this update…

Aug 13, 2013 at 9:09am

…and what i tried to do is : launching an application which doesn’t have a graphical interface, through [shell]. It should be the same than an application with a graphical interface. That’s why my question could be confusing…

…Regarding the commandline applications, it is another question ; which answer is “yes, you can” using the new penter/pwrite message.

This is awesome ! thanks ! sorry for the confusing/confused questions :)

Aug 13, 2013 at 9:22am

An application without a graphical interface is the same as a command line application, as far as I’m concerned. Anyway, yes, it all seems to be working for me. I’ve made a few improvements and updated a new version of the object to the original post:

Aug 14, 2013 at 3:09am

it’s an application that opens in a separate process than commandline, which you can’t interact with in console, but has no gui ; you just see its icon in the dock when it’s running. Then maybe it does have a gui, but an empty gui ; and maybe it’s an unwise programming practice !…

Aug 14, 2013 at 3:31am

Ah ok, you mean a faceless background application, I guess. The point of the ‘shell’ object is to provide access to the OS shell — so you can launch or kill such an application, you can run an Applescript or similar which targets such an application, but if it doesn’t provide a command line interface, there’s not much you can do with it otherwise.

Aug 14, 2013 at 6:45am

Faceless background application, that’s it ;) just launching it at a patcher’s loading is useful in my case.

Aug 14, 2013 at 9:06am

Nice work. In the past I’ve handled shell stuff successfully from pyext, will have to give this a look.

Aug 23, 2013 at 4:11am

thanks jeremy, you are a legend. this is big news.

especially excited by:

“infrastructure for a Windows CMD version added”

…with that added, there will be world peace.

Sep 22, 2013 at 11:41am

Can someone help me out with my message formatting? Neither of these 2 options work for making ImageMagick produce an animated GIF. The bottom one works in Terminal.

I tried removing the space from the paths to no avail.


– Pasted Max Patch, click to expand. –


Sep 22, 2013 at 6:28pm

hmmmm, two possibilities…
1/either in the first case you need \ before each blank space
2/or you need to format the filepaths using conformpath. I can’t really do that here since i don’t have imagemagick

eitherway, sending something in hyphens (” “) should not work, you need the \ before each hyphen.


– Pasted Max Patch, click to expand. –


Sep 22, 2013 at 6:43pm

(it seems to be something else entirely)

Sep 23, 2013 at 12:08pm

hey tanx, I ultimately went the pyext way since I need windows support as well

I had tried the \’s though

Sep 23, 2013 at 12:09pm

perhaps this helps:

– Pasted Max Patch, click to expand. –


Nov 30, 2013 at 2:21am

Thanks! Great!

If I want AppleScript Editor to run a script, what message do I have to send to the shell object?


Dec 16, 2013 at 1:27am

Hahahah ! it toggled the system shell!!

Dec 16, 2013 at 1:33am

@ubu, you want “osascript”: more info

Feb 27, 2014 at 11:43am

Hi All-
I’m having a heck of a time being able to ssh to another computer.
My message into [shell] is as follows:

ssh (username)@(localIP)

It works like a champ in Terminal, but I can’t get it to respond in Max.

I’m an sound/interface guy and I don’t have a ton of experience in terminal, but I’ve searched all over the forums and other sites for answers, and I just can’t seem to find out what I’m doing wrong.


Feb 27, 2014 at 11:45pm

Recently I was working with shell and realised that, where commands in Terminal are executed with default arguments, in this case you need to provide them. I understand that’s why, as an example, you can type top in Terminal, but in max that doesn’t work (and top -s 1 -l 3600 -stats pid\,cpu\,time\,command does). The ssh command I don’t (didn’t) know, but I see that typing ssh [Enter] in the Terminal gives all possible arguments. Does this make any sense?


You must be logged in to reply to this topic.