Re: shell variables
From: Walter Spector (w6ws_xthisoutx_at_earthlink.net)
Date: 02/08/05
- Next message: robert.corbett_at_sun.com: "Re: Can I address 16GB of RAM with a single threaded FORTRAN application ?"
- Previous message: Richard: "Can I address 16GB of RAM with a single threaded FORTRAN application ?"
- In reply to: gtg531e: "Re: shell variables"
- Next in thread: gtg531e: "Re: shell variables"
- Reply: gtg531e: "Re: shell variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 08 Feb 2005 05:10:25 GMT
gtg531e wrote:
>
> Unfortunately It can not read shell variables
> $LINES and $COLUMNS...
> What Is wrong?
Try 'export'ing them. At least on my machine, the shell doesn't export
them by default. If an environment variable is unavailable, the ierror
arg should return EINVAL.
Here is a simple test program which works on my home machine (homegrown
version of PXF running under cygwin):
program testpxf
#if defined (F90CHECK)
#if defined (__INTEL_COMPILER)
use ifposix
#else
use pxf_definitions
#endif
#endif
implicit none
integer :: nvars
parameter (nvars=4)
character(32) :: vars(nvars)
data vars /"USER", "HISTSIZE", "LINES", "COLUMNS"/
character(32) :: result
integer :: lena, lenb
integer :: i, errno
logical :: pass
! Get values for desired variables
pass = .true.
do, i=1,nvars
lena = len_trim (vars(i))
print *, 'Testing: ', vars(i)(:lena)
call pxfgetenv (vars(i), lena, result, lenb, errno)
if (errno /= 0) then
call warn ('pxfgetenv', errno)
pass = .false.
end if
print *, vars(i)(:lena), '=', result(:lenb)
end do
if (pass) then
print *, 'PASS'
else
print *, 'FAIL'
end if
end
(Subroutine warn not included. But basically does a 'perror' operation.)
When I run this in a 'new' shell, I get:
$ getenv_test
Testing: USER
USER=wws
Testing: HISTSIZE
WARN: pxfgetenv, Invalid argument
HISTSIZE=
Testing: LINES
WARN: pxfgetenv, Invalid argument
LINES=
Testing: COLUMNS
WARN: pxfgetenv, Invalid argument
COLUMNS=
FAIL
$
However if I then try:
$ export LINES COLUMNS HISTSIZE
$ getenv_test
Testing: USER
USER=wws
Testing: HISTSIZE
HISTSIZE=500
Testing: LINES
LINES=65
Testing: COLUMNS
COLUMNS=140
PASS
$
BTW, since you are using the Intel compiler, be sure to use the latest
compiler version you can lay your hands on...
Walt
-...-
Walt Spector
(w6ws at earthlink dot net)
- Next message: robert.corbett_at_sun.com: "Re: Can I address 16GB of RAM with a single threaded FORTRAN application ?"
- Previous message: Richard: "Can I address 16GB of RAM with a single threaded FORTRAN application ?"
- In reply to: gtg531e: "Re: shell variables"
- Next in thread: gtg531e: "Re: shell variables"
- Reply: gtg531e: "Re: shell variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|