comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Strange UNIX or strange IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Strange UNIX or strange IDL? [message #13367 is a reply to message #13366] Fri, 06 November 1998 00:00 Go to previous messageGo to previous message
Vap User is currently offline  Vap User
Messages: 31
Registered: April 1998
Member
Harald Frey <hfrey@ssl.berkeley.edu> writes:

> IDL> print,!version
> { sparc sunos unix 5.1 Apr 13 1998}
> IDL> pwd=getenv('PWD')

> IDL> print,pwd
> /disks/sprite/disk1/hfrey/idl/image/wic
> IDL> pwd=getenv('pwd')
> IDL> print,pwd
>
> IDL>
>

Getenv returns the value of the input argument, provided there is an
environmental variable currently defined matching that argument. It
returns a null string if there there isn't. PWD is always defined in
the Cshell (not sure about sh, but I think it must be true for it as
well). These environmental variables are, by convention,
uppercase. Getenv('pwd') returns null because the evnrionmental
variable is 'PWD', not 'pwd'.


> With the name argument of getenv set to capital letters I get the right
> answer, but in small letters 'pwd' returns the null string. However, if
> I use the same command on the UNIX platform I get
>
> image1 [1] pwd
> /disks/sprite/disk1/hfrey/idl/image/wic
> image1 [2] PWD
> PWD: Command not found
>
> and UNIX does not like the capital letter 'PWD'.
>
> Any explanation?
>

'pwd' is a *command* in the cshell that returns the *value* of the
environmental variable 'PWD'. 'PWD' is not any command -unless you are
unwise enough to have to have a shell script or binary in your path
with that name - so attempting to execute it at the command line will
result in complaints from the shell.


> Harald Frey
> hfrey@ssl.berkeley.edu
>

All of this is very unix-centric and will probably not work on a
non-unix machine. If you want portable code, try...

pro pwd
cd,current=current & print,current
end

which should work whatever the platform.


--
I don't speak for JPL, it doesn't speak for me.
Well, not all the time, at least.
William Daffer <vapuser@haifung.jpl.nasa.gov>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: random numbers with gamma distribution
Next Topic: Converting characters to real

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 02:36:25 PDT 2025

Total time taken to generate the page: 1.03896 seconds