![]() |
|
|
|
|
|||||||
| 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 |
| Setting up variables | solar_ext | UNIX for Dummies Questions & Answers | 3 | 03-28-2008 08:50 AM |
| Setting numbered variables | michaeltravisuk | UNIX for Dummies Questions & Answers | 1 | 10-28-2007 05:35 AM |
| Setting variables in a function | BCarlson | Shell Programming and Scripting | 1 | 03-29-2006 08:15 AM |
| cat setting variables | skotapal | Shell Programming and Scripting | 3 | 09-10-2002 06:55 AM |
| Setting up shell variables | rachael | UNIX for Dummies Questions & Answers | 1 | 10-21-2001 08:16 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
setting some variables
i have a file .NAME
Code:
export MY_NAME=JOE Code:
#. .NAME $echo MY_NAME $JOE Code:
. .NAME Code:
#sh Run.sh #echo $MY_NAME |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
If you want the variable to be displayed when you run "RUN.sh" , you need to source the "RUN.sh" script also.
mv run.sh .run.sh sh .run.sh and it would do the needful. |
|
#3
|
|||
|
|||
|
Hi nua7,
i tried your suggestion, its still not working. |
|
#4
|
|||
|
|||
|
Which shell are you using? Really shouldn't make a difference since this is common for all the shells.
I tried doing it and it is succesful in displaying the variable MY_NAME. Can you show me your steps with the output..? |
|
#5
|
|||
|
|||
|
Hi new2ss,
I believe that u wont get the output if u run sh Run.sh or sh .run.sh as the new variable will be set only in the shell created for Run.sh and the shell wud terminate once the execution of run.sh is over so, if u want to achieve the result then u shld run like . Run.sh or . .run.sh |
|
#6
|
|||
|
|||
|
Hi, i am using bash shell.
the output was exactly the same as what i posted earlier. |
|
#7
|
|||
|
|||
|
Hi quintet,
your suggestion worked. Thanks. Because i need to set it as a cronjob, would typeing . run.sh at the crontab entry work? |
|||
| Google The UNIX and Linux Forums |