I am in the c shell. I was under the impression that if I type ksh, then the .profile will get executed, and it will also execute x.tm. But I do not see hello world printed out.
In addition, if I manually do .profile, then I get
.profile is run automatically when you login with ksh as your login shell, not when you type ksh. You said that you were using csh. tset will notice that and output setenv statements for you. The backticks try to run the output from tset.
thanks for the reply, but I am still a little confused.
ok, so .profile is not executed when I type ksh and go to the korn shell. But I would have thought that if I then did .profile in the korn shell, it will at least run that script (which looks like below)
Notice that I said "tset will notice that and output setenv statements for you. The backticks try to run the output from tset." That is what is happening. What effect did expect from
eval ` tset -s -Q `
$
$
$ cat script1
#! /usr/bin/ksh
echo setenv this that
exit 0
$
$
$ cat script2
#! /usr/bin/ksh
eval `./script1`
exit 0
$
$
$
$ ./script1
setenv this that
$ ./script2
./script2: setenv: not found
$
script2 has no setenv statement either. But it is trying to run one.
thanks. I'll have to read up on tset to understand exactly what it is doing.
I was reading another thread of yours
and I have three questions
first, my system is set up so that when I login the csh is invoked. Now to get to my korn shell, I type ksh. But I cannot do su - username, as that always takes me to another csh. All my korn shell settings are in .profile. Is there another way for me to call korn shell preceded with - so that my .profile gets executed? (without me having to source it manually).
when I source my .profile manually, the ENV file seems to lose the speacial meaning as it does not seem to be called. Is this expected?
in the above thread you talk about ps -pf $$. I am assuming $$ means the pid of the running shell, yes?
Well, $$ is the pid of the current process. No, the ENV should not be affected by sourcing a file unless you fiddle with the ENV file. And you should not be trying to mislead a subshell into thinking it is a login shell.
The best thing for you to do would be to switch your shell to ksh and csh and just use a single interactive shell. If you don't want to do that, then your login script (.login or .profile) should set up your environment and only your environment without touching anything else. Your environment is the stuff that gets printed wit the commands "printenv" and "env". Your one unified environment must be powerful enough for any interactive shell. That means, for example, that your csh .login must establish the ENV variable for later use with ksh. Each shell that you use must have a startup script. That script will check to see if the shell is interactive. If so, it will do any aliases, options, etc that you need for interactive work.
It will take some effort to get all of this working for unix was not designed to support multiple interactive shells. Everyone else picks one... at least for a while. There is a chsh command on many versions of unix so you can switch later.
wow, we have chsh on our system and it worked. Great!
I also like the ps -pf $$ a lot better than using $SHELL, as $SHELL can be changed by someone. I was surprised a book mentioned that $SHELL should be used to find out your shell and not the other way!