accessing home directory via ~

FX fxcoudert@gmail.com
Mon Feb 4 20:38:00 GMT 2008


> I think we should call wordexp() on filename arguments (i.e. consider the current behavior a bug).
> I assume that you're seeing the same discrepancy with shell variables, as in '$SOMEDIR/test.dat'?

Of the compilers I've tried (Intel, Sun, IBM, Pathscale, MIPS, g95,
gfortran), only Intel expands ~ as the current user home directory and
none of them expand shell variables. I think it is not desirable to
change the current behaviour about ~ (and even less about ~user and
$variable). In some cases, I would even consider it a bug. Consider
the case of :

    open(10,file="$TEST",action="write",status="replace")
    open(20,file="~/test",action="write",status="replace")
    end

I want the first one to open a file named "$TEST", and if there is a
directory named "~" in my current directory, I expect the second one
to open the file named "test" in "~".

After all, there are convenient ways in F2003 to access environment variables.

FX


-- 
FX Coudert
http://www.homepages.ucl.ac.uk/~uccafco/



More information about the Fortran mailing list