Prof. Skoruppa on Thu, 15 Dec 2005 14:29:26 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: reading environment variables into gp?

Hi John,

str = Strexpand("$HOME") and val = eval( Strexpand("$NUMBER")) do these jobs for me.

Nils-Peter Skoruppa
Algebra and Number Theory
University of Siegen, Germany

On Thu, 15 Dec 2005, Prof. J. E. Cremona wrote:

It would be very helpful if a gp script could read the value of a (unix)
environment variable, into a string or integer variable.

For example, something like


would result in s being a string variable.  The C function getenv() does
this, so perhaps it would be simply a question of install-ing it?

Motivation:  I can run a script simultaneously on N processors in a
cluster;  the job on the i'th processor sets the environment variable
SGE_TASK_ID to the integer value i.  Now, I would like each job to know
the value of i so that I can select a parameter from a list -- so that
all processors can use the same script instead of having to edit N
separate ones.

Apologies if this is already possible -- I did look in the manual and
also searched the list archives!


Prof. J. E. Cremona             |
University of Nottingham        | Tel.:  +44-115-9514920
School of Mathematical Sciences | Fax:   +44-115-9514951
University Park                 | Email:
Nottingham NG7 2RD, UK          |

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.