If not set by the user, then how is PATH set?

If not set by the user, then how is PATH set?

Post by Wiley Sande » Sun, 17 May 1992 15:00:58



For example, if not explicitly set in .cshrc or .login, PATH defaults
to ":/usr/ucb:/bin:/usr/bin" in SunOS. How is this
default changed by the sysadmin? Or is it built in to the shell? Exam-
ination of the sh and csh binaries with strings find the above path
in sh but not csh, so it seems to be built in. Am I correct?
  Send replies via mail and I will summarize and repost. If the method varies
among OS's or shells, other versions' methods of doing it would be interesting.
  Thanks
-wiley
 
 
 

If not set by the user, then how is PATH set?

Post by Leif Jens » Sun, 17 May 1992 16:53:32



>For example, if not explicitly set in .cshrc or .login, PATH defaults
>to ":/usr/ucb:/bin:/usr/bin" in SunOS. How is this
>default changed by the sysadmin? Or is it built in to the shell? Exam-
>ination of the sh and csh binaries with strings find the above path
>in sh but not csh, so it seems to be built in. Am I correct?

% strings /bin/login | grep :/usr/ucb
:/usr/ucb:/bin:/usr/bin
%

From man environ(5):

     PATH                The sequence of directory prefixes  that
                         sh(1), time(1V), nice(1), etc., apply in
                         searching for a file known by an  incom-
                         plete   path  name.   The  prefixes  are
                         separated by `:'.  The login(1)  process
                         sets PATH=:/usr/ucb:/bin:/usr/bin.

So it appears that in SunOS 4.1.2, at least, login sets the PATH.

Hope this helps,
Leif Jensen

 
 
 

If not set by the user, then how is PATH set?

Post by Wiley Sande » Tue, 19 May 1992 02:41:35



>% strings /bin/login | grep :/usr/ucb
>:/usr/ucb:/bin:/usr/bin
>...
>So it appears that in SunOS 4.1.2, at least, login sets the PATH.

The above path is also revealed by strings in /bin/sh This answers my
question; thanks to those who responded.
-w
 
 
 

1. set path = "$path" hoses path in tcsh -- why???

All:

  % echo $path
  /usr/local/bin /usr/pubsw/bin /usr/bin ...
  % ls
  [... etc ... it works]
  % set path = "$path"   *** What the hell happens here??? ***
  % echo $path
  /usr/local/bin /usr/pubsw/bin /usr/bin ... looks the same
  % ls
  ls: Command not found.

This is just a particularly egregious illustration of the problem. In
general, if I try to do something like this:

  % set savedPath = "$path"  # Save current path
  % set path = "$savedPath"  # Restore saved path

it doesn't work. The path *looks* the same, but the shell can't find
anything. Recall that the shell variable path and the environment
variable PATH are linked, so setting one automatically sets the other
also. Some unexpected feature of list interpolation perhaps? Bug or
feature, I call it a pain...

Andrew Duncan

2. sccs/rcs cross platform use ?

3. Solutions: KDE not starting KDM loop PATH not SET

4. Q: MACH32 EEPROM modes usable/readable for XFREE ?

5. How does a chmod command affect login script path setting and any umask set?

6. IP Masq. not working under 2.1.x

7. Setting the user path

8. Shared memory segment system limit?

9. user homepath set as his root path

10. setting PATH for root user

11. Where do I set universal paths for all users?

12. Setting the PATH for all users

13. What sets initial PATH for root and users?