From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,447a948bb64464c3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-14 15:30:57 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!howland.reston.ans.net!pipex!uunet!aadt!ventures!a311581 From: a311581@ventures.NoSubdomain.NoDomain (Kevin Cline) Subject: Re: I have a question... Message-ID: Sender: a311581@ventures (Kevin Cline) Organization: American Airlines Decision Technologies References: <1994Oct07.034523.161470@zeus.aix.calpoly.edu> Date: Fri, 14 Oct 1994 21:25:49 GMT Date: 1994-10-14T21:25:49+00:00 List-Id: In article , emery@goldfinger.mitre.org (David Emery) writes: |> The easiest way to 'solve' this problem is to expand the "~" into the |> home directory. The environment variable "HOME" contains the pathname |> of the home directory. Thus it's pretty trivial to implement an |> operation that replaces (all) occurances of "~" in a pathname with the |> string value of HOME. |> |> To be more accurate/precise, the best thing to do is to obtain the |> pathname to the home directory from the /etc/passwd file, since the |> value of HOME could have been changed by the user. It is not a good idea to read /etc/passwd. Use getpwent(2). It knows about NIS. Actually, various UNIX shell flavors differ in their interpretation of ~. The c-shell always replaces ~ with the value of the home variable, or if that is not set (the usual case) then with the user's login directory. The Bourne shell does not support ~ at all. The Korn shell replaces ~ with the value of the HOME variable. GNU bash replace ~ with the value of the HOME environment variable. You should probably use the HOME environment variable, since users that change it are probably pretending to be someone else for a good reason. Kevin Cline