Unix Shell - control Value of variable within multi-scripts

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > February 2005 > control Value of variable within multi-scripts





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author control Value of variable within multi-scripts
shell

2005-02-26, 7:47 am

Hi Friends,
I appreiciate your help on following:
I have 1st script that always runs one command.
command
I want modif it to follwing to add 2 conditions.

CHECK=NO
if [[ "$CHECK" = "YES" ]];then
command
fi

Now I want to create 2nd and 3rd scripts.
2nd scriptshould change the variable CHECK to YES. And that could be
used when we run the 1st script after running 1st separately.
3rd must reset the variable to original.

What I need is value of variable must remain same as set by 2nd script
for all sessions and retained by reboots, unless changed by 3rd
command.


Thanks and regards

Bill Marcum

2005-02-26, 5:53 pm

On 26 Feb 2005 05:03:32 -0800, shell
<sonchacan@hotmail.com> wrote:
>
> Now I want to create 2nd and 3rd scripts.
> 2nd scriptshould change the variable CHECK to YES. And that could be
> used when we run the 1st script after running 1st separately.
> 3rd must reset the variable to original.
>
> What I need is value of variable must remain same as set by 2nd script
> for all sessions and retained by reboots, unless changed by 3rd
> command.
>

2nd script:
echo "CHECK=YES" > checkthis
other scripts:
if [ -f checkthis ]; then . checkthis; fi
shell

2005-02-27, 7:47 am

Thanks !!
It works!!

Bill Marcum wrote:
> On 26 Feb 2005 05:03:32 -0800, shell
> <sonchacan@hotmail.com> wrote:
be[vbcol=seagreen]
script[vbcol=seagreen]
> 2nd script:
> echo "CHECK=YES" > checkthis
> other scripts:
> if [ -f checkthis ]; then . checkthis; fi


shell

2005-02-27, 7:47 am

Bill, Thanks much
It worked!!

Bill Marcum wrote:
> On 26 Feb 2005 05:03:32 -0800, shell
> <sonchacan@hotmail.com> wrote:
be[vbcol=seagreen]
script[vbcol=seagreen]
> 2nd script:
> echo "CHECK=YES" > checkthis
> other scripts:
> if [ -f checkthis ]; then . checkthis; fi


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com