Re: Problem with "~" in Unix FINDFILE, still? [message #2311] |
Thu, 09 June 1994 08:36 |
dnguyen
Messages: 4 Registered: May 1994
|
Junior Member |
|
|
In article <1994Jun8.120922@ossenu.astro.nwu.edu>, pendleton@ossenu.astro.nwu.edu (Jim Pendleton) says:
>
> Could someone verify the following Unix IDL "bug" for me in a more recent
> version of IDL than 3.0.0?
>
> The problem I am seeing is that the FINDFILE function doesn't properly
> interpret a "~" as a symbol for the home directory.
.....
> produces output as I would expect. Note that the use of a "." for current
> directory rather than a "~" does work properly.
To bypass this "bug", I use $HOME to represent my home directory.
For example:
IDL> PRINT,FINDFILE("$HOME | grep filename")
|
|
|
Re: Problem with "~" in Unix FINDFILE, still? [message #2314 is a reply to message #2311] |
Thu, 09 June 1994 03:42  |
knipp
Messages: 68 Registered: January 1993
|
Member |
|
|
In article 120922@ossenu.astro.nwu.edu, pendleton@ossenu.astro.nwu.edu (Jim Pendleton) writes:
> Could someone verify the following Unix IDL "bug" for me in a more recent
> version of IDL than 3.0.0?
>
> The problem I am seeing is that the FINDFILE function doesn't properly
> interpret a "~" as a symbol for the home directory.
>
...
Unfortunately my version is just slightle "more recent" than yours
(SunOs, IDL 3.1.1), but I can confirm that "bug".
What I do to overcome that is to test every filename in the following
way:
- starting with '~'
> change to getenv('HOME')
- starting with '$XYZ'
> change to getenv('XYZ')
- starting with neither '.' nor '/'
> search along IDL_PATH for appropiate file
I've coded the tests in a routine. If someone's interested I'll
post/-email that routine.
Karlheinz
____________________________________________________________ __________________
__ ____ __
/ // _ \ / / Karlheinz Knipp phone: +49 511 - 762 4922
/ // /_/ // / University of Hannover fax: +49 511 - 762 2483
/ // ____// / Institute for Photogrammetry
/ // / / / Nienburger Str.1
/_//_/ /_/ FRG 30167 Hannover e-mail: knipp@ipi.uni-hannover.de
|
|
|
Re: Problem with "~" in Unix FINDFILE, still? [message #2318 is a reply to message #2314] |
Thu, 09 June 1994 06:54  |
robijn
Messages: 18 Registered: June 1994
|
Junior Member |
|
|
In article <1994Jun8.120922@ossenu.astro.nwu.edu>,
Jim Pendleton <pendleton@ossenu.astro.nwu.edu> wrote:
> Could someone verify the following Unix IDL "bug" for me in a more recent
> version of IDL than 3.0.0?
>
> The problem I am seeing is that the FINDFILE function doesn't properly
> interpret a "~" as a symbol for the home directory.
>
It is not a bug - the documentation for IDL 3.5 clearly states that the
Bourne shell (/bin/sh) is used. "~" is a csh feature and can't be used.
Use '$HOME' instead.
Frank
--
_____ ____
/ / / Frank Robijn Internet: Robijn@Strw.LeidenUniv.NL
/___ /___/ Sterrewacht Leiden Bitnet: Robijn@HLERUL51
/ / \ Phone (31) 71 275841 Local: Robijn@HL628
/ / \ Fax : (31) 71 275819 Snail: P.O.Box 9513, 2300 RA Leiden,
The Netherlands
|
|
|
Re: Problem with "~" in Unix FINDFILE, still? [message #2322 is a reply to message #2314] |
Thu, 09 June 1994 06:04  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
pendleton@ossenu.astro.nwu.edu (Jim Pendleton) writes:
> Could someone verify the following Unix IDL "bug" for me in a more recent
> version of IDL than 3.0.0?
> The problem I am seeing is that the FINDFILE function doesn't properly
> interpret a "~" as a symbol for the home directory.
> For instance
> IDL> A = FINDFILE("-F ~ | grep /")
> results in zero entries for me in both Ultrix and SunOS versions of IDL 3.0.0.
> However,
> IDL> SPAWN, "ls -F ~ | grep /", OUTPUT
> IDL> PRINT, OUTPUT
> produces output as I would expect. Note that the use of a "." for current
> directory rather than a "~" does work properly.
I'm not sure that one can describe it as a *bug* exactly. :^) The ~ symbol is
a function of the C shell (and some others such as tcsh and ksh). However, the
Bourne shell does not appear to recognize ~ as $HOME. Probably, IDL spawns out
to the Bourne shell to find files.
These days, though, most people use some other shell than the Bourne shell. It
would be nice if IDL interpreted ~ as they expect it to. I never thought to
try something as fancy as Jim Pendleton did, but I would expect to be able to
say something like
IDL> A = FINDFILE('~/*.dat')
Bill Thompson
|
|
|
Re: Problem with "~" in Unix FINDFILE, still? [message #2325 is a reply to message #2314] |
Thu, 09 June 1994 03:18  |
knipp
Messages: 68 Registered: January 1993
|
Member |
|
|
In article 120922@ossenu.astro.nwu.edu, pendleton@ossenu.astro.nwu.edu (Jim Pendleton) writes:
> Could someone verify the following Unix IDL "bug" for me in a more recent
> version of IDL than 3.0.0?
>
> The problem I am seeing is that the FINDFILE function doesn't properly
> interpret a "~" as a symbol for the home directory.
>
...
Unfortunately the "more recent version" of mine is just 3.1.1 (SunOs), but
I can comform that "bug".
Anyway, each filename I define I test on the following:
starts with '~'
--> change to getenv('HOME')
starts with '$XYZ'
--> change to getenv('XYZ')
starts with neither '.' nor '/'
--> serach along IDLPATH for file
If someone is interested I'll post/e-mail the routine performing the
described tests.
Karlheinz
____________________________________________________________ __________________
__ ____ __
/ // _ \ / / Karlheinz Knipp phone: +49 511 - 762 4922
/ // /_/ // / University of Hannover fax: +49 511 - 762 2483
/ // ____// / Institute for Photogrammetry
/ // / / / Nienburger Str.1
/_//_/ /_/ FRG 30167 Hannover e-mail: knipp@ipi.uni-hannover.de
|
|
|