StartUp script Environmental Issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting StartUp script Environmental Issue
# 1  
Old 06-15-2009
StartUp script Environmental Issue

Hi There,

I have created a StartUp script which will create all alias's and export my path to GLOBAL so that i will be have some handy commands for simplifying my work

My script code is like below

------------------------------------
#!/usr/bin/ksh
set -o vi
#Display the CURRENT USER and PROGRAM NAME on the TERMINAL
typeset -L CurUser=$(whoami)
typeset CurProg=$(basename ${0})
echo "The Current User is : ${CurUser}"
echo "The Current Program is : ${CurProg}"
#EXPORT the local BIN directory so that all scrits will run
#with their names. No need of external call KSH.
typeset -L CurPath=$(echo $PATH)
typeset -L NewPath=${CurPath}:${HOME}/bin
export NewPath
#Load all ALIAS's for User Flexibility.
alias lst="ls -ltr"
alias lsa="ls -latr"
alias ps="ps -ef | grep -v grep | grep $(whoami)"
alias home="cd ~"
alias root="cd /"
alias search="grep"

My script is running fine without any errors. After the script, if i give lsa it is giving the ERROR as ksh:lsa: not found.
(Actually we need to give all these commnds in .profile file but i dont have WRITE permissions to this file so i came up with this StartUp script).


Please suggest, how to make these commands GLOBAL?


-- Ramesh.
# 2  
Old 06-15-2009
Code:
. StartUp

# 3  
Old 06-15-2009
Try running the script as:

Code:
. ./scriptname

# 4  
Old 06-17-2009
Hi vgersh,

. StartUp.sh is not working. It is giving the message as . is not found in KSH.

methyl,

. ./StartUp.sh is working fine. It is running the script but after the script is completed, my session is closing automatically. If i login again, these alias are not working.
I coded exit 0 at the end of the script. Is it the issue for closing my session?

-- RaamC.
# 5  
Old 06-17-2009
Hi methyl,

I have removed the exit 0 from the code and executed the script again with . ./StartUp.sh.

It is working fine now...all alias's are loaded into Environment as i required.

Thank you methyl,

-- RaamC.
# 6  
Old 07-15-2009
Hi All,

How to run same script in bash. I tried to run same script by using . ./startup.sh but it is giving the error as file not found.

Can any one help me how to run these script in bash?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

<< Environmental Variables are not set when script completes >>

Hi Team, I have a wrapper script which i have pasted below, it internally calls one python script to generate Environmental in a file called /home/oracle/myenv.sh, when i execute this script via wrapper script, its not reflecting in my current session, still showing old env variables. any... (2 Replies)
Discussion started by: kamauv234
2 Replies

2. Shell Programming and Scripting

Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post - #!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO ... (14 Replies)
Discussion started by: Hijanoqu
14 Replies

3. Shell Programming and Scripting

Issue with cron and environmental variable

My shell script it.sh.I am calling bip.sh from it.sh #!/bin/sh ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin; export PATH today=`date "+%m-%d-%Y %H:%M:%S"`; export today CUR_DIR=$1; export CUR_DIR LOG_FILE=$CUR_DIR/error.log;... (4 Replies)
Discussion started by: rafa_fed2
4 Replies

4. UNIX for Dummies Questions & Answers

SQL loader script - ORACLE environmental variable

I am new in unix.. I am running a sql loader script where I have to specify the data file path but the file name contains spaces in it so giving error multiple arguments I have tried it with "" and '' but does n't work the command is : $ORACLE_HOME/bin/sqlldr... (1 Reply)
Discussion started by: Sandip Dey
1 Replies

5. AIX

startup script

Hi I need the below script to be started whenever I reboot my aix server ? #cat cdbegin /cdirect/cdunix/ndm/bin/cdpmgr -i /cdirect/cdunix/ndm/cfg/cbspsdb01/initparm.cfg Please suggest how to add this to the startup ? (2 Replies)
Discussion started by: samsungsamsung
2 Replies

6. Shell Programming and Scripting

Oracle environmental variables in shells script

Hi, Getting below error on executing the shell script which initiates sqlplus How to set oracle enviornment variables in the shell script ? With Regards (3 Replies)
Discussion started by: milink
3 Replies

7. Shell Programming and Scripting

How to get the value of a variable which is having another value in environmental script?

Dear Folks, I am facing an issue in getting a value of a variable.Let me explain the scenario. I am having a list file say files.list in which I have mentioned 1 FILE1 2 FILE2 Then I am having an set_env.ksh in which I mentioned FILE1=/clocal/data/user/userdata.txt... (4 Replies)
Discussion started by: dinesh1985
4 Replies

8. UNIX for Dummies Questions & Answers

Sol_9 => Sol_10/08 Upgrade svc startup issue.

Dear all, Recently I did an upgrade from Solaris 9 to Solaris 10 on a V440 System, after the initial reboot after the auto-reboot from the OS upgrade, the service: svc:/system/webconsole:console transitions into maintenance and cannot be manually brought online. Below are a list of things I... (0 Replies)
Discussion started by: ShawnLua
0 Replies

9. UNIX for Dummies Questions & Answers

init issue on startup

Hi, I modified my inittab file in the /etc directory. When I started up my machine, system hangs on initialization. I'm trying to remove what I added in the inittab file so that everything is back to normal. I'm using AIX 5 and I would like to boot up so I can get back into a regular... (0 Replies)
Discussion started by: dhuser
0 Replies
Login or Register to Ask a Question