korn shell .kshrc in sunos


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting korn shell .kshrc in sunos
# 1  
Old 12-23-2008
korn shell .kshrc in sunos

Hi,
My login shell is c shell

I have a line in .cshrc like
setenv a 1000

I have a line in .profile like
ENV=$HOME/.kshrc
export ENV

and in my .kshrc
a=10
export a

I wrote one korn script

#!/bin/ksh
echo $a


it must have shown o/p 10 rathe it is showing 1000

Please tell me how is the flow happening

I heard/know that if I use korn shell script, it is going to read .profile and .kshrc!
# 2  
Old 12-24-2008
Using the shebang "#!/bin/ksh" in your script doesn't force the script to read the .profile file.
To use the environment variables declared in .profile 'source' the .profile as follow:

Code:
. /path/to/.profile

within your script.

Regards
# 3  
Old 12-24-2008
Thanks Franklin.

When I say like

#!/bin/ksh
. ~/.profile
...
...


.profile getting executed but it is not considering .kshrc as environment file even though I have the following lines in my .profile file

export ENV=$HOME/.kshrc
# 4  
Old 12-24-2008
Code:
export ENV=$HOME/.kshrc

doesn't set the environment variables of .kshrc, 'source' .kshrc:

Code:
. /path/to/.kshrc

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bourne shell & Korn shell

Could some one tell me the difference btw Bourne shell and the Kshell? Which is more flexible and reliable in terms of portability and efficiency. When i type the following command .. $ echo $SHELL yields me /bin/sh Does this tells me that I am in Bourne shell. If yes, how can i get... (6 Replies)
Discussion started by: bobby1015
6 Replies

2. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

3. Shell Programming and Scripting

.kshrc is not executing

Hi, I am facing two problems in my environment. Anyone can help on this? Thanks in advance. Problem 1 --------- When i login into my new unix system, only the .profile is executing. .kshrc is not executing. But my default shell is .ksh Any setup to be changed ? Problem 2... (7 Replies)
Discussion started by: senthil_is
7 Replies

4. Shell Programming and Scripting

.profile not reading .kshrc

Can anyone tell me why .profile would not be reading my .kshrc file? O/S is SCO 5.06? I've placed echo's before & after setting ENV and nothing ... help? Thanks! Here's .profile ================================================== : # DoubleVision Pro's digiboard call during... (7 Replies)
Discussion started by: gseyforth
7 Replies

5. Shell Programming and Scripting

kshrc

An odd problem using .kshrc, if I run with this in my home login directory it works fine other than if I use 'man', where each word of the manual entry is on a seperate line ?. I'm using AIX 5.3 (it worked fine on 5.2). Anyone seen this before ? (3 Replies)
Discussion started by: gefa
3 Replies

6. UNIX for Dummies Questions & Answers

not able to execute .profile /.kshrc

Hi, I m new to Solaris CDE...earlier i was using Windows. Here is my problem.. i know that whatever the initial settings we need to execute,we can place them in .profile file. in my home dir (/home/venki),i have following files for that. .profile .profile.user .kshrc .kshrc.user ... (2 Replies)
Discussion started by: Venky
2 Replies

7. Shell Programming and Scripting

Unix Korn Shell Array Issue (SunOS)

Hello, I'm currently messing around with arrays for the first time in scripting (Unix Korn Shell). All I'm trying to do right now before I make things complicated is read through and print out to screen whether the read file is or is not a directory. Here is my directory: ls -l total... (5 Replies)
Discussion started by: Janus
5 Replies

8. Shell Programming and Scripting

SunOS shell help

I'm new to SunOS and I need some help. I'm trying to run the commands below inside the korn shell below on SunOS 5.8 but it does not do anything except echo ABC. No error gets displayed when running the shell. #!/bin/ksh echo ABC export ENV_1=/folder1/subfolder cd folder2 All 3... (2 Replies)
Discussion started by: stevefox
2 Replies

9. Shell Programming and Scripting

how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell.. #!/bin/ksh home=c:/..../ input=$1 sed '1,3d' $input > $1.out line="" cat $1.out | while read a do line="$line $a" done echo $line > $1 rm $1.out however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies

10. Shell Programming and Scripting

KORN Shell - Spawn new shell with commands

I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server.. I have seen some code that may help - but I cant get it working as below: spawn /usr/bin/ksh send "telnet x <port_no>\r" expect "Enter command: " send "LOGIN:x:x;... (2 Replies)
Discussion started by: frustrated1
2 Replies
Login or Register to Ask a Question