Re: Funny if-condition in the root profile
From: Umberto (umberto.quaia_at_tin.it)
Date: 09/13/05
- Next message: RolandRB: "Is there an "fsed" utility?"
- Previous message: Mabden: "Re: fgets and EOF in Bash"
- In reply to: n.attico_at_tiscali.it: "Funny if-condition in the root profile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 13 Sep 2005 14:49:53 +0200
n.attico@tiscali.it wrote:
> Hi,
>
> I've found in the .profile of the root user on a Sun machine (Sun OS
> for Intel platforms) the following if-condition:
>
> if [ $0 != "ksh" -a $0 != "-ksh" ]
> then
> exec ksh -o vi
> else
> set -o vi
> fi
>
> I understand this is trying to set vi as the shell editor but it's
> unclear to me what it is tryng to test.
>
> Can you understand the purpose of this condition?
>
> TIA
> Nicola Attico
>
An exec in .profile? Definitely bad style, expecially
considering .profile is used both for interactive and
non-interactive shells... Even worse if it's root's.
Good luck when you will try to debug anything!
My advice?
Delete everything and tell sysadmins stop to play with
system files. Root's files should *never* be tweaked.
Default root configuration must stay default root
configuration. Create a directory (profiles, for example)
and put profiles for each user in that directory.
Supposing I am user "umb", I would execute, then:
$ . profiles/.umb
Mario would execute
$ . profiles/.mario
Barry
$ . profiles/.barry
Nicola
4 . profiles/.nicola
And so on.
Everyone has its favourite settings, but system
configuration is unaffected!
There's no bad in personalization, and indeed UNIX gives us
a very flexible environment, however messing up with system
configuration is unadvisable. Just confine user settings and:
1) you will have a default configuration for your scripts
and for OS technical support (imagine the scene: Sun senior
SA comes to solve some weird issue, finds everything messed
up, and loses half an hour just finding how settings are;
and imagine the opinion he/she may have about the local
system administrators...)
2) each system administrator keeps its favourite settings
segregated while being able to activate/reset them up
whenever he/she wants very quickly
3) it's easy to start with the default, standard configuration
4) you will avoid the bad policy that each sysadmin starts
to put in .profile what he/she thinks are the best settings
(for him/her) at the moment
5) you avoid finding every day a different setup (see above)
6) you avoid having each day a different bug in your scripts
7) your backup won't fail because of corrupted .profile
IMO, just point 7 is enough to justify keeping your
configuration untouched.
Actually, there may be settings which may be put in .profile
without counterindications or tests to be inserted, but I
think that a good methodology is the better choice in the
long term... And it teaches everyone to work well, giving
good example for future similar issues (Oracle user and
every application account).
Only personal users should modify their .profile directly.
Umberto
- Next message: RolandRB: "Is there an "fsed" utility?"
- Previous message: Mabden: "Re: fgets and EOF in Bash"
- In reply to: n.attico_at_tiscali.it: "Funny if-condition in the root profile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|