[PD] [shell] on OSX...

2007-10-18 Thread Derek Holzer
...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? Also, it doesn't seem to understand, for example 
cd /home/derek, since a pwd command immediately after still lists 
/ as the current dir. Suggestions to speed it up/make it listen?

OSX 10.4.10
PD-0.39.2-extended-test4
PD-0.39.2-extended-rc4

best,
d.

-- 
derek holzer ::: http://www.umatic.nl ::: http://blog.myspace.com/macumbista
---Oblique Strategy # 105:
Listen to the quiet voice

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] [shell] on OSX...

2007-10-18 Thread IOhannes m zmoelnig
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

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] [shell] on OSX...

2007-10-18 Thread IOhannes m zmoelnig
Derek Holzer wrote:
 Hi IOhannes,
 
 IOhannes m zmoelnig wrote:
 
 what you are sending to [shell] basically _is_ a shellscript...
 
 Ah, OK, now I see. I've been doing it the way you suggested, and as I 
 reported it's painfully slow. Several degrees of ten times slower than 
 the same commandline entered into an open terminal. Or even that opening 
 a new terminal and then entering the command. I thought maybe there 
 would be a way to make it faster.

#!/bin/bash
netreceive  udp | while read line
do
 mkdir -p $(echo ${line} | sed -e 's|;$||')
done

[symbol\
|
[send /home/derek/test_$1(
|
[netsend 1]


 
 if it get's more complicated just do it like this

 #!/bin/sh
 cd /home/derek
 mkdir test_$1

 and call your script with [/path/to/myscript.sh $1( 
 
 So simple bash scripts can use $1 as well? That was what I was unsure 
 about. I thought there was other syntax to introduce variables into them 
 that I *didn't* know.

it's the other way round: pd can use $1 as well, just like other
languages, including bash.
and what's more, $0 has a more logical meaning in bash...


fgnasdr.
IOhannes

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] [shell] on OSX...

2007-10-18 Thread Roman Haefeli
On Thu, 2007-10-18 at 19:15 +0200, IOhannes m zmoelnig wrote:
 Derek Holzer wrote:
  Hi IOhannes,
  
  IOhannes m zmoelnig wrote:
  
  what you are sending to [shell] basically _is_ a shellscript...
  
  Ah, OK, now I see. I've been doing it the way you suggested, and as I 
  reported it's painfully slow. Several degrees of ten times slower than 
  the same commandline entered into an open terminal. Or even that opening 
  a new terminal and then entering the command. I thought maybe there 
  would be a way to make it faster.
 
 #!/bin/bash
 netreceive  udp | while read line

pdreceive  udp | while read line # there is no 'netreceive' command

 do
  mkdir -p $(echo ${line} | sed -e 's|;$||')
 done
 
 [symbol\
 |
 [send /home/derek/test_$1(
 |
 [netsend 1]

yeah, nice example of a server. thanks

roman






___ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: 
http://mail.yahoo.de


___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list