![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accessing variables of one shell script in another shell script | rsendhilmani | Shell Programming and Scripting | 2 | 03-17-2009 01:17 AM |
| Accessing PL/SQL OUT variables in Korn Shell Script | bright_future | UNIX for Advanced & Expert Users | 4 | 12-02-2008 12:02 PM |
| accessing shell script variable in file | HIMANI | UNIX for Dummies Questions & Answers | 6 | 08-06-2007 11:07 PM |
| concurrency issue while Accessing Mail Box from shell script | Sumit_Fundoo | UNIX for Advanced & Expert Users | 2 | 02-25-2007 02:23 PM |
| Accessing the home directory in shell script | krishan | SUN Solaris | 1 | 05-21-2005 12:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Accessing var from .profile into shell script
I have defined variable in .profile file. This variable, I tried to use in a shell script
for the same session. In Shell script it is not finding this variable, but the same variable on the console if I try to access by echo $var, it is giving me correct assigned value. Can anyone, please guide me how to use variable defined in .profile in the shell script? |
|
||||
|
Quote:
Did you export the variable to the environment before using it in the session? |
|
||||
|
This is how you normally define it and use it:
In your profile you should have- export SCRIPTSD_P=$HOME/2005/some_dir #This is how you use it in your script- $SCRIPTSD_P/perf_jobs.sh This is not a solution but let me tell you some thing. Hopefully, you are not doing that in your shell script. One time I tried to change the value of $SCRIPTSD_P in a shell script and I re-executed my .profile from within the shell script. Ex: #Some shell script export $SCRIPTSD_P=$HOME/2005/some_new_dir #re-executing the profile into the current session. . $HOME/2005/.profile But, for some reason $SCRIPTSD_P didn't take the new value. I never could find out why. Did you check to see if you are changing the variable's value. |
|
||||
|
I have a Korn Shell.
In my script, if I need to read some file, then common path to file is in this variable. fName=$Access_Dir/FileName.txt awk '{print $0}' fName Second line awk is symbolic, I have one awk operation with fName. I am running this script from command prompt. |
|
|||||
|
Quote:
awk '{print $0}' $fName Quote:
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|