1745795 Members
3625 Online
108722 Solutions
New Discussion юеВ

csh and ksh shells

 
SOLVED
Go to solution
Shivkumar
Super Advisor

csh and ksh shells

Hi,

Our one of the weblogic server startup script is configured to start as a user whose environement shell varibale
is setup in csh ( c shell ).

If i start the weblogic start up script changing the shell in ksh korn shell; will it cause any issue ?

Thanks,
Shiv
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor
Solution

Re: csh and ksh shells

Hi Shiv:

It doesn't matter that a startup script written in one shell language starts another script written in another language.

What matters is that the interpreter declared on the "she-bang" line --- the first line of a script that begins with "#!" --- matches the command syntax in the body of the script.

That is, if you write:

#!/usr/bin/csh

...then the syntax used afterwards is C-shell.

That does *not* prevent you from launching another script that is written in the Korn or Posix shell, however. For instance:

#!/usr/bin/csh
...
/usr/local/bin/mything

...where '/usr/local/bin/mything' is a Korn shell script.

Regards!

...JRF...


Yang Qin_1
Honored Contributor

Re: csh and ksh shells

Hi, the varibales are defined differently in csh and ksh:
ksh "export DISPLAY=xxx.xxx.xxx.xxx:0.0"
ksh "export PATH=$PATH"
csh "set display=xxx.xxx.xxx.xxx:0.0"
csh "set path=( $path )"

You have to checl and maybe modify that script if you want to use ksh.


Yang
Shivkumar
Super Advisor

Re: csh and ksh shells

The script being run by a weblogic applicaton user to start weblogic servers is in c shell. i use powerbroker to become that user to start the server.

once i become that particular user which uses c shell; i am not able to use "$set -o vi" which i usually use to access previous commands.

i usually use ksh shell to access previous commands by executing $set -o vi.

just wanted to know if i execute ksh and then run the startup script.. will it impact anything ?

Regards,
Shiv

Yang Qin_1
Honored Contributor

Re: csh and ksh shells

If you want to run a c shell script under k shell, you have to test it. Depends on what is written in that script, it may work or it may fail.

If you just want to have commands history under csh. You can try "history", it will list the commands you have typed. "!2" will excute the command you have run the one befire last command. Read manpage of csh to have more information on command history.


Yang
James R. Ferguson
Acclaimed Contributor

Re: csh and ksh shells

Hi (again) Shiv:

> You wrote, "once i become that particular user which uses c shell; i am not able to use "$set -o vi" which i usually use to access previous commands."

That's true. The retrieval of the shell history of commands using 'vi' is a Posix/Korn method; not a C-shell ('csh') one.

However, once you are in the 'csh' you can switch to 'ksh' or 'sh' by typing the name of the shell in which you want to operate:

# ksh

This starts a new shell, and the environmental variables you had before will need to be reestablished. When you exit this shell, you will return to the predecesor.

> You also asked: "just wanted to know if i execute ksh and then run the startup script.. will it impact anything?"

No, you will not, as I first responded. You can start any binary or script of any kind from any shell type.

Regards!

...JRF...





James R. Ferguson
Acclaimed Contributor

Re: csh and ksh shells

Hi Shiv:

Ooops, I meant to write:

This starts a new shell, and the environmental variables you had before will not need to be reestablished."

Consider:

# echo "I am a ${SHELL} shell"
I am a /sbin/sh shell
# export X=shiv
# export Y=jrf
# csh
# echo "I am the ${shell}"
I am the /usr/bin/csh
# echo "${X} asked a question and ${Y} answered"
shiv asked a question and jrf answered
# set Z=ok
# echo ${Z}
ok!
# exit #...going back to original shell!
# echo ${Z}
sh: Z: Parameter not set.

...The last echo of ${Z} shows that the parent does not inherit the child's environment.

Regards!

...JRF...