[PD] [shell] on OSX...

Derek Holzer derek at umatic.nl
Thu Oct 18 17:45:42 CEST 2007


Hi IOhannes,

thanks for the clarifications. I understand now why [shell] doesn't stay 
in "/home/derek" between commands.

I'm not so good at shell scripts, so bear with me for a second....

What I'd like to do is pass variables.... so, for example:

cd /home/derek && mkdir test_$1

--where $1 is a number created by PD and sent to the shell script. The 
dir name could be constructed by [nsprint], for example, as it may have 
other variable as well. The shell script would only need a single 
variable to receive the constructed dir name.

Does that make sense? Is this easy to do?

thx!
d.


IOhannes m zmoelnig wrote:
> Derek Holzer wrote:
>> ...is painfully slow! It takes minutes sometimes to execute a command 
>> that the terminal handles is a second or two. Why is that? Does anyone 
>> else have this problem? 
> 
> i cannot help you here, but most likely it is a problem with 
> initializing a context:
> everytime you call shell, it will have to restart the shell-interpreter 
> which will take some time (when you start the terminal it also takes 
> some time...once the terminal is up and running it is faster, but you 
> don't get this with the [shell])
> 
> btw, this is the reasons why many often-used applications are often 
> re-written as daemons (e.g. i have a virus-scanner that usually get's 
> called from the cmdline to scan a file - this is too slow if you are 
> using it on a mailserver; therefore there is a daemonized version of the 
> scanner which is always running and which takes the data to be scanned 
> via a pipe)
> 
> this is also one of the reasons i hardly ever use [shell] but usually 
> write a small shellscript server (using ./pdreceive) and send data to 
> this server via [netsend] (and vice versa)
> i often find this more stable (and fun), but it is more complicated to 
> setup.
> 
> 
>> Also, it doesn't seem to understand, for example "cd /home/derek", 
>> since a "pwd" command immediately after still lists "/" as the current 
>> dir. 
> 
> 
> what makes you think it doesn't understand?
> whenever you call shell, it will open up a new context.
> so when you send "cd /home/derek" it will changedir into /home/derek 
> (from /) and then quit. when you call "pwd" it will print the working 
> directory of a fresh context (which is /)
> it is like when you open a terminal and do a "cd /usr/local" and then 
> open another terminal and do a "pwd"...
> this behaviour is the same on all platforms.
> 
> therefore you one usually uses scripts for more complex operations:
> $ cat /tmp/doit.sh
>  #!/bin/sh
>  cd /home/derek
>  pwd
> 
> and then do
> [/tmp/doit.sh(
> |
> [shell]
> 
> 
> 
> 
> 
> fmadsr.
> IOhannes
> 

-- 
derek holzer ::: http://www.umatic.nl ::: http://blog.myspace.com/macumbista
---Oblique Strategy # 2:
"A line has two sides"




More information about the Pd-list mailing list