I checked the help patch of [shell], but if I send a cd command for example, I don't think that something really happens. I actually would like to run a script from within Pd, but what I understand is that this can't be really done, is it so? Can anyone demonstrate something like this?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2013-01-29 11:23, Alexandros Drymonitis wrote:
I checked the help patch of [shell], but if I send a cd command for example, I don't think that something really happens. I actually would like to run a script from within Pd, but what I understand is that this can't be really done, is it so? Can anyone demonstrate something like this?
that's exactly the point: with [shell] you _should_ run scripts.
each command you send to [shell] will open a new "context".
so if you send it a "cd ..", it will create a new context (in your working directory, lets call it ${WD}), move one directory up (so we are now in ${WD}/.., report any output (not very much in this case), and close the context. if you then send it a "pwd", it will create a new context (in your working directory ${WD}), print the PWD and close the context.
obviously your "cd.." did not affect "pwd", as they have been executed in different contexts.
in order to do anything more complex, you have to create a script-file, and run this via [shell]. e.g.
<snip> #!/bin/sh cd .. pwd </snip>
and run "myscript.sh" via [shell] should give you ${WD}/..
fgamsdr IOhannes
I don't really understand the meaning of 'context' (not the actual word, but the way you're using it)..how are these contexts accessible? How are commands being executed when sent to the same object?
On Tue, Jan 29, 2013 at 12:41 PM, IOhannes m zmoelnig zmoelnig@iem.atwrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2013-01-29 11:23, Alexandros Drymonitis wrote:
I checked the help patch of [shell], but if I send a cd command for example, I don't think that something really happens. I actually would like to run a script from within Pd, but what I understand is that this can't be really done, is it so? Can anyone demonstrate something like this?
that's exactly the point: with [shell] you _should_ run scripts.
each command you send to [shell] will open a new "context".
so if you send it a "cd ..", it will create a new context (in your working directory, lets call it ${WD}), move one directory up (so we are now in ${WD}/.., report any output (not very much in this case), and close the context. if you then send it a "pwd", it will create a new context (in your working directory ${WD}), print the PWD and close the context.
obviously your "cd.." did not affect "pwd", as they have been executed in different contexts.
in order to do anything more complex, you have to create a script-file, and run this via [shell]. e.g.
<snip> #!/bin/sh cd .. pwd </snip>
and run "myscript.sh" via [shell] should give you ${WD}/..
fgamsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlEHp1UACgkQkX2Xpv6ydvQxewCgoxOK3SpyBVJOD+/WkFCt3CjT UPkAoNnAAwJwK9f5kaQNRysEesOexAU5 =bZxD -----END PGP SIGNATURE-----
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2013-01-29 11:59, Alexandros Drymonitis wrote:
I don't really understand the meaning of 'context' (not the actual word, but the way you're using it)..how are these contexts accessible? How are commands being executed when sent to the same object?
a "context" is simply a new shell process (i tried to avoid the naming to prevent confusion with the [shell] object; seems like i failed).
you cannot "access" it.
it's very similar to the following. open a terminal (which will run an instance of /bin/sh)
me@foo$ cd /tmp me@foo$ pwd /tmp me@foo$ /bin/sh sh-4.2$ pwd /tmp sh-4.2$ cd ~ sh-4.2$ pwd /home/me sh-4.2$ exit me@foo$ pwd /tmp me@foo$ /bin/sh sh-4.2$ pwd /tmp
here you are running a shell session (context, process) within another shell; whatever you do with in the first sub-shell (lines 4..10), will not effect what you can do in the 2nd subshell (14..15)
gvmnasdr IOhannes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Le 29/01/2013 11:59, Alexandros Drymonitis a ?crit :
I don't really understand the meaning of 'context' (not the actual word, but the way you're using
it)..how are these contexts accessible? How are commands being executed when sent to the same object?
On Tue, Jan 29, 2013 at 12:41 PM, IOhannes m zmoelnig <zmoelnig@iem.at
mailto:zmoelnig@iem.at> wrote:
On 2013-01-29 11:23, Alexandros Drymonitis wrote:
I checked the help patch of [shell], but if I send a cd command for example, I don't think that something really happens. I actually would like to run a script from within Pd, but what I understand is that this can't be really done, is it so? Can anyone demonstrate something like this?
that's exactly the point: with [shell] you _should_ run scripts.
each command you send to [shell] will open a new "context".
so if you send it a "cd ..", it will create a new context (in your working directory, lets call it ${WD}), move one directory up (so we are now in ${WD}/.., report any output (not very much in this case), and close the context. if you then send it a "pwd", it will create a new context (in your working directory ${WD}), print the PWD and close the context.
obviously your "cd.." did not affect "pwd", as they have been executed in different contexts.
in order to do anything more complex, you have to create a script-file, and run this via [shell]. e.g.
<snip> #!/bin/sh cd .. pwd </snip>
and run "myscript.sh" via [shell] should give you ${WD}/..
fgamsdr IOhannes
Pd-list@iem.at mailto:Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Hello,
By 'context', it is as if you start each time from the beginning (same 'initialization'). You see that when you open a new shell by creating a new terminal window :
As you can see the values returned by pwd are not the same because, each time you open a terminal window, you open a new shell. It is the same under Pd and the object [shell], each time you send a message to [shell], each time you open a new shell. That's why you need a script if you need to execute a sequence of several commands. ++
Jack
Ok, I understand the whole 'context', shell thing. I tried what you guys suggested in a terminal window and kind of got the picture. But the way [shell] works remains a mystery to me (even though it's the same way a teminal window works). I have a few scripts saved in a folder called 'scripts' in the 'Documents' folder in my home directory. In a terminal window I do the following:
cd Documents/scripts/ sh myscript.sh
and the script runs, no problem. But what the equivalent action with [shell]? The same steps won't give the same result..
On Tue, Jan 29, 2013 at 1:50 PM, Jack jack@rybn.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Le 29/01/2013 11:59, Alexandros Drymonitis a ←crit :
I don't really understand the meaning of 'context' (not the actual word,
but the way you're using it)..how are these contexts accessible? How are commands being executed when sent to the same object?
On Tue, Jan 29, 2013 at 12:41 PM, IOhannes m zmoelnig <zmoelnig@iem.at
mailto:zmoelnig@iem.at zmoelnig@iem.at> wrote:
On 2013-01-29 11:23, Alexandros Drymonitis wrote:
I checked the help patch of [shell], but if I send a cd command for example, I don't think that something really happens. I actually would like to run a script from within Pd, but what I understand is that this can't be really done, is it so? Can anyone demonstrate something like this?
that's exactly the point: with [shell] you _should_ run scripts.
each command you send to [shell] will open a new "context".
so if you send it a "cd ..", it will create a new context (in your working directory, lets call it ${WD}), move one directory up (so we are now in ${WD}/.., report any output (not very much in this case), and close the context. if you then send it a "pwd", it will create a new context (in your working directory ${WD}), print the PWD and close the context.
obviously your "cd.." did not affect "pwd", as they have been executed in different contexts.
in order to do anything more complex, you have to create a script-file, and run this via [shell]. e.g.
<snip> #!/bin/sh cd .. pwd </snip>
and run "myscript.sh" via [shell] should give you ${WD}/..
fgamsdr IOhannes
Pd-list@iem.at mailto:Pd-list@iem.at Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Hello,
By 'context', it is as if you start each time from the beginning (same 'initialization'). You see that when you open a new shell by creating a new terminal window :
- open new terminal window
- enter 'cd ..' then return
- enter 'pwd' then return
- close terminal window
- open new terminal window
- enter 'pwd' then return
As you can see the values returned by pwd are not the same because, each time you open a terminal window, you open a new shell. It is the same under Pd and the object [shell], each time you send a message to [shell], each time you open a new shell. That's why you need a script if you need to execute a sequence of several commands. ++
Jack
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJRB7eFAAoJEOuluecjw8GU7CoIAJcT9AYfR7QQ1LkrUOmMxTul fhqfkhx13MeHa/N30H2D+mHf0iM6OqHcXiVASJcsOinMSyLnPbw313dhuCgmccLl vc51hB5nScrSfn+xpOetALxjHXQ9sq+cr8cXboQdGdYEbChyuITAifaN0KihsMWw O1+/nSA9bfr9BfMG7G+s+u/u+938a2rU3whp4VdFB5eA0kZkX5YBeD46A6vByBXE sxoZg0MlgkKaUdLc60aMrM5LU1PWQmK8aA1QiqEd4ebYF3oN79VxZh7ekkV2DGp2 KOYxfWHzLLSpPJhDtZDoF1zWJHyhLQ74uIycFwOV+TQOfj3/APD7AN1qXrDwsbQ= =II3H -----END PGP SIGNATURE-----
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2013-01-29 13:56, Alexandros Drymonitis wrote:
Ok, I understand the whole 'context', shell thing. I tried what you guys suggested in a terminal window and kind of got the picture. But the way [shell] works remains a mystery to me (even though it's the same way a teminal window works). I have a few scripts saved in a folder called 'scripts' in the 'Documents' folder in my home directory. In a terminal window I do the following:
cd Documents/scripts/ sh myscript.sh
run "./Documents/scripts/myscript.sh"
dfamser IOhannes
If you are using Pd-extended 0.43.4, or are willing to install pdlua/tclpd, I recommend writing objects in Lua or Tcl rather than writing scripts for [shell]. pdlua and Tclpd scripts will give you real Pd objects that act just like Pd objects. [shell] is useful, but it works differently than normal Pd objects.
Look in the Help Browser, under pdlua and tclpd for examples.
.hc
On 01/29/2013 07:56 AM, Alexandros Drymonitis wrote:
Ok, I understand the whole 'context', shell thing. I tried what you guys suggested in a terminal window and kind of got the picture. But the way [shell] works remains a mystery to me (even though it's the same way a teminal window works). I have a few scripts saved in a folder called 'scripts' in the 'Documents' folder in my home directory. In a terminal window I do the following:
cd Documents/scripts/ sh myscript.sh
and the script runs, no problem. But what the equivalent action with [shell]? The same steps won't give the same result..
On Tue, Jan 29, 2013 at 1:50 PM, Jack jack@rybn.org wrote:
Le 29/01/2013 11:59, Alexandros Drymonitis a ←crit :
I don't really understand the meaning of 'context' (not the actual word,
but the way you're using it)..how are these contexts accessible? How are commands being executed when sent to the same object?
On Tue, Jan 29, 2013 at 12:41 PM, IOhannes m zmoelnig <zmoelnig@iem.at
mailto:zmoelnig@iem.at zmoelnig@iem.at> wrote:
On 2013-01-29 11:23, Alexandros Drymonitis wrote:
I checked the help patch of [shell], but if I send a cd command for example, I don't think that something really happens. I actually would like to run a script from within Pd, but what I understand is that this can't be really done, is it so? Can anyone demonstrate something like this?
that's exactly the point: with [shell] you _should_ run scripts.
each command you send to [shell] will open a new "context".
so if you send it a "cd ..", it will create a new context (in your working directory, lets call it ${WD}), move one directory up (so we are now in ${WD}/.., report any output (not very much in this case), and close the context. if you then send it a "pwd", it will create a new context (in your working directory ${WD}), print the PWD and close the context.
obviously your "cd.." did not affect "pwd", as they have been executed in different contexts.
in order to do anything more complex, you have to create a script-file, and run this via [shell]. e.g.
<snip> #!/bin/sh cd .. pwd </snip>
and run "myscript.sh" via [shell] should give you ${WD}/..
fgamsdr IOhannes
Pd-list@iem.at mailto:Pd-list@iem.at Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Hello,
By 'context', it is as if you start each time from the beginning (same 'initialization'). You see that when you open a new shell by creating a new terminal window :
- open new terminal window
- enter 'cd ..' then return
- enter 'pwd' then return
- close terminal window
- open new terminal window
- enter 'pwd' then return
As you can see the values returned by pwd are not the same because, each time you open a terminal window, you open a new shell. It is the same under Pd and the object [shell], each time you send a message to [shell], each time you open a new shell. That's why you need a script if you need to execute a sequence of several commands. ++
Jack
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list