- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Simultaneuse variable definition confict ..
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 10:10 AM
03-04-2004 10:10 AM
I have 2 mirror scripts, that run exactly at same time set thru cron.
shell #1 has:
PROC=billmag01
.....
shell #2 has:
PROC=bilmal77
...
eventually second script definition overides the first one (as their name are SAME=PROC), though I thought that those Vars will be accessible only inside their scripts.
I'm not doing iny special in my shells regarding Vars definition (exprot,etc...).
Is there any way to isolate those vars inside shells. Or probaly I can add any dinamic extensions to their names:
PROC.&&=billmag01 ....etc..
Will apprec any pro opinions, I have 25 of those shells, so thinking how to make it most reliable and fast.
Thank
Dai
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 10:13 AM
03-04-2004 10:13 AM
Re: Simultaneuse variable definition confict ..
shell #1 has:
PROC=billmag01
.....
shell #2 has:
PROC=bilmal77
...
During execution shell #1 set PROC to bilma177 (that is from shell #2).
Tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 10:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 10:27 AM
03-04-2004 10:27 AM
Re: Simultaneuse variable definition confict ..
if those scripts do not interact, it does not matter how often you use PROC, it is separated. More likely you have an unwanted assigment to PROC or a call . shell2
no need for PROC.&&
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 10:30 AM
03-04-2004 10:30 AM
Re: Simultaneuse variable definition confict ..
It is considered good form these days to use the typeset command everywhere.
#!/usr/bin/sh
myfunc()
{
typeset -i10 MYVAR=10
((MYVAR += 1))
echo "MYVAR inside myfunc = ${MYVAR}"
return 0
}
typeset -i10 MYVAR=100
echo "MYVAR = ${MYVAR}"
myfunc
echo "MYVAR = ${MYVAR}"
This example uses the same variable within
the same script. The typeset command used within a function causes the local copy to take precedence. The -i10 declares the variable to be a base-10 integer.
A typeset -x MYVAR command causes MYVAR to be automatically exported to child processes.
Man sh-posix for details.
One other way that two scripts can APPEAR to share data is the use of the "." command.
Inside shell1.sh if you add this statement:
. ./shell2.sh
then everything in shell2.sh becomes part of shell1.sh. It is NOT a child process, in that case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 10:52 AM
03-04-2004 10:52 AM
Re: Simultaneuse variable definition confict ..
Yes, theory is all right!
Probably I will expand my case, how it happened.
1.Each of shells send email, given value of PROC=bill is going to subject line, like:
elm -s " $PROC" -a $MAILTO < temp2 >> $LOGFIL
2. shell#1, shell#2 reside in same directory, but there is no any kind of interaction between them, neither misspelling in PROC=... definition.
3. I have mail sent by shell#1 (judge by logfile, email body and attachments) with subject from shell#2.
I realize that me is the main suspect in this case, but I checked multiple times all spelling in both shells.
Maybe ELM that uses SENDMAIL on background treats those variable somehow else then in shell or ....????
Thanks
Dai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 10:58 AM
03-04-2004 10:58 AM
Re: Simultaneuse variable definition confict ..
both shells scheduled to run in cron:
00 21 2-5 * * /appl/shell1
00 21 3-6 * * /appl/shell2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 11:01 AM
03-04-2004 11:01 AM
Re: Simultaneuse variable definition confict ..
I agree with the conclusions above.
Just thought I'd confirm your thoughs on sendmail and elm.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com