With standard shell or compatible shell (/etc/passwd has /bin/sh or /bin/ksh or /bin/bash or /bin/zsh) it uses
for a shell-internal variable. And
to promote it to environment. Environment is inherited by the commands that the shell invokes.
The standard shell and compatibles process such commands in $HOME/.profileat a login.
If the shell in /etc/passwd is /bin/csh or /bin/tcsh then the syntax is different:
for shell-internal, and
for environment. There is some confusion if you do both with the same variable. By convention you should do
I.e. lowercase of internal variables and uppercase for environment variables.
The csh and tcsh process such commands in $HOME/.loginat a login.
Usually the SHELL environment variable is set from the one in /etc/passwd:
Last edited by vbe; 04-25-2017 at 04:08 AM..
Reason: typo
You did not say what version of HP-UX you are working on...
Till 11.23 ( after I dont know...) the default user shell was ksh , so you would use either .profile or .kshrc in your home directory, for root user its a little different...
I will add to previous post that you can in .kshrc and even in .profile now ( since 11.00 ? ) use also this syntax:
Thanks for the correcting me, was so obvious I zapped the magic line you need in .profile ...
There is a good reason to use a .kshrc if you use/have heavy customisation.:
To be sure no one has a corrupt environment when upgrading/patching OS if a new .profile is provided in the upgrade, it will be used as default for all users, thus avoiding extra most probable useless calls to internal support team... and as MadeInGermany flagged, the only thing we check here is that the magic line is present , if not will be added to the default...
Things get more complicated when using X server on PC with ssh and have an heterogenous environment with many flavours of UX/linux...
A correction: ksh does not take .kshrc. It takes an environment variable ENV.
You can of course put the following into .profile
If ENV is found in the environment when an interactive ksh is invoked, then parameter expansion, command substitution, and arithmetic substitution are performed on the value of $ENV to generate the pathname of a script that will be executed before the first prompt is issued. If ENV is not found in the environment when an interactive ksh is invoked and there is a file named .kshrc in your login directory, that file will be executed before the first prompt is issued.
Depending on how ksh is configured on your system, it may also look for /etc/ksh/.kshrc. On systems that are configured to use this file, you can skip executing it by setting ENV to a string starting with /./ or ././ (such as /.$HOME/.kshrc to execute only $HOME/.kshrc or /./dev/null to avoid executing either of those files).
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Hello,
Per our forum rules, all threads must have a descriptive subject text. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt". Post subjects like "Execution Problems with Cron" or "Help with Backup Shell Script".
The reason for this is that nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, the subject field must be something useful and related to the problem!
In addition, current forum users who are kind enough to answer questions should be able to understand the essence of your query at first glance.
So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your subject text. You might receive a forum infraction if you don't pay attention to this.
Hi
I'm trying to understand variable scopes in solaris10.
It is said that to display env variables we use 3 commands :
- env
- set
- export
What is the difference between them ?
thx for help.
---------- Post updated at 11:00 AM ---------- Previous update was at 10:50 AM ----------
... (2 Replies)
Does know where I can find what ALL of the set options do in vi? I can't find it anywhere in vi's man pages or help files. I know about :set all but a lot of the options I have no clue what they do. (3 Replies)
Hi All,
I use "export DISPLAY=same_host:0.0" to set my export DISPLAY and it is working fine for me..
Problem here is I have developed a script for which i should run export DISPLAY prior to running my script....
so my script should check whether export DISPLAY is set or not.. if... (6 Replies)
I thought that set and setenv was easy enough to understand until I started experimenting.
I noticed the same problem in a previous thread, so I will use it as an example.
set command gave the following output:
argv ()
cwd /homes/e/ee325328/assignment.2
home /homes/e/ee325328
path ( a... (2 Replies)
I never undestood exactly what's the difference between the SET and SETENV commands.
One sets variables visible to all users and the other (SETENV) only to the specific user environment ?
Thanks in advance,
BraZil - thE heLL iS HEre :mad: !!! (2 Replies)
Well first of all I am a real Unix newbie. I am taking a course on it in University. I kind of understand set and setenv but, I think it si something that I should really understand. So I thought that I would try a forum out and see how good you guys really are.
The question:
Execute the... (1 Reply)