run a script to set a globle varible?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting run a script to set a globle varible?
# 1  
Old 12-18-2009
run a script to set a globle varible?

Hi,

My original shell is csh, I don't likw it, so I have to run bash every time after I login, the problem is I have a script like

export PLOG=$1,

every time I run the script under bash, the PLOG won't be set, I know I can use source to set the PLOG, is there any other way to do it?

thanks.

peter
# 2  
Old 12-18-2009
If I get what you want:
put any commands you need to execute in a file .bashrc in your home directory.
Every time the shell starts it will read/execute the file, just as if you were to source it.
# 3  
Old 12-18-2009
When you execute the script, try using this syntax to make the environment variable which you set in the script stay in the environment.

Code:
. ./scriptname

(Dot space dot slash scriptname).
# 4  
Old 12-18-2009
thanks, it works.

Quote:
Originally Posted by methyl
When you execute the script, try using this syntax to make the environment variable which you set in the script stay in the environment.

Code:
. ./scriptname

(Dot space dot slash scriptname).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Set script to run during specific times

Hi all, I have this script which sends mail whenever the system is down. It works fine. Normally the system is down from 21 00 to 21 30 from Monday to Saturday and from 21 00 on Sunday to Monday 06 00 for maintenance. So I want the below script to run only when the system is up, i.e outside the... (2 Replies)
Discussion started by: frum
2 Replies

2. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

3. Solaris

How to set automatic run?

Hi, I have a script in my home directory. it has to be run every day. as of now, im manually running as ./myscript.sh Can someone please tell me how to set it as automatic run (runs everyday at specific time ) so that it runs even if im not there. (9 Replies)
Discussion started by: JSKOBS
9 Replies

4. Shell Programming and Scripting

How to substitute a varible in script having value including quotes?

Hi All, We need to run a Connect direct script on Unix server to send a file to Mainframe server and at mainframe end there need to run another job through Runtask with some parameters need to be passed from C:D (unix) to mainframe. My question is I have to pass parameters like DSN and FNAME as... (2 Replies)
Discussion started by: matrix001
2 Replies

5. Shell Programming and Scripting

Need help howto make a script for Set SNOOP run for 5 minutes

Hi all, I want to monitoring my interface every 6 hours where i want to run snoop command to capture all packet through the interface, so i want running snoop then snoop will run for 5 minutes after that snoop stop then will start again after 6 hours than run for 5 minutes again. thereis any... (9 Replies)
Discussion started by: tindasz
9 Replies

6. Shell Programming and Scripting

How to run a set of commands through ssh

I need to run a set of commands on a remote machine using ssh. it should also collect output and return status of each command. Can someone help me how to do this? (1 Reply)
Discussion started by: vickylife
1 Replies

7. Shell Programming and Scripting

set schedule to run a script at background while logout

Hi, How can I run a script at 9:00am and 6:00pm everyday? Can I run it at background while I logout my account? Please help!! Many Thanks!! (1 Reply)
Discussion started by: happyv
1 Replies

8. Shell Programming and Scripting

chaging a environment varible using sheel script

hi How can one change an environment varaible inside a shell script say my bash shell has a env variable export FOO="Day" no i want to write a script inside which the FOO variable is modified to say export FOO=NIGHT after this script finishes te bash shell should show me NIGHT when i... (1 Reply)
Discussion started by: wojtyla
1 Replies

9. UNIX for Dummies Questions & Answers

globle replace comand in VI editor

Folks, How can I do a globe search & replace in VI editor? Any help? Thanks. (2 Replies)
Discussion started by: ting123
2 Replies

10. Shell Programming and Scripting

Using varible/varible substitution in Perl/sed Search & Replace

Hi, I have a program that searches for a particular string patten. I am however having difficulty passing the varible $i (in a loop) as the string pattern to replace. Using either perl or sed search and replace statements, I get the same kinda result. For example, using the perl: for i in... (3 Replies)
Discussion started by: Breen
3 Replies
Login or Register to Ask a Question