The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with global and local variables qzv2jm Shell Programming and Scripting 2 03-04-2008 01:18 PM
Declaring Global Variables in KLD int80h BSD 1 01-21-2008 09:11 AM
global variables in KLD (FreeBSD) int80h High Level Programming 0 01-17-2008 08:14 PM
perl global variables reggiej Shell Programming and Scripting 3 08-29-2005 08:18 AM
declare, assign variables using array, counter, loop egkumpe Shell Programming and Scripting 3 08-09-2004 10:56 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-31-2007
risshanth risshanth is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 64
How to declare global variables for shell script

Hi,
I do have some variables accessed in more than one script. I want to have those variables in a command file anduse them. Something like a header file that we use in C programs. I dont want to set them as environment variables. Is there any other option, like header file in scripting ??

I am using HP-Unix....
  #2 (permalink)  
Old 10-31-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
The classic approach is to "source" a script file, using "."

eg


Code:
. /path/myfilecontainingsomevars.sh
  #3 (permalink)  
Old 10-31-2007
risshanth risshanth is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 64
Thumbs up

Thanks porter .. its working ...
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0