![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem accessing Multiple Variables from C Program to a Shell script | sameworld1980 | Shell Programming and Scripting | 1 | 09-10-2008 01:56 PM |
| problem with environment variables | Naughtydj | SUN Solaris | 1 | 06-28-2008 02:27 AM |
| passing a variables value from the called script to calling script using ksh | rajarkumar | Shell Programming and Scripting | 9 | 06-19-2008 02:33 PM |
| gdb problem viewing variables | rimon | HP-UX | 0 | 11-21-2007 02:35 AM |
| problem with variables | udi | Shell Programming and Scripting | 2 | 12-22-2001 11:14 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem in script when using variables
The AppName may be TCS/HCL/SCB.
For All the above 3 i ill have exported TCSDIR/HCLDIR/SCBDIR in .profile with some path. i'm cnstruct the path in script and trying to cd $VARIABLE, it shows "not found". Any solution for this....? Code:
> AppName="TCS"
> echo $AppName
TCS
> start_path="\$${AppName}DIR/src"
> echo $start_path
$TCSDIR/src
> cd $start_path
ksh: $TCSDIR/src: not found
> cd $TCSDIR/src
/tmp/TCS_TEMP/src>
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Assuming the name of the directory is /TCSDIR/scr
Code:
start_path=/${AppName}DIR/src
|
|
#3
|
|||
|
|||
|
$TCSDIR is the env variable set in my .profile
so i'm creating that based on the input in my script. When i'm using that in script i'm getting issue. $TCSDIR is /tmp/TCS_TEMP which is exported in .profile |
|
#4
|
|||
|
|||
|
You need to use eval to expand a variable inside another variable.
Code:
eval echo $start_path |
|
#5
|
|||
|
|||
|
Thanks, Its working.
|
|||
| Google The UNIX and Linux Forums |