determining OS
Hi All!
I have a script (perl v5.8.5) that needs to run on both AIX and
linux. Does anyone have a code snippit that would allow the script
to determine which OS it is currently running under? Any help would
be greatly appreciated!
Thank you!
Greg
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: determining OS
Try the following on each of the machines.
perl -w -e 'print $^O, "\n";'
Curtis
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Greg
Schraiber
Sent: Tuesday, July 17, 2007 3:55 PM
To: activeperl [at] listserv.ActiveState.com
Subject: determining OS
Hi All!
I have a script (perl v5.8.5) that needs to run on both AIX and linux.
Does anyone have a code snippit that would allow the script to determine
which OS it is currently running under? Any help would be greatly
appreciated!
Thank you!
Greg
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: determining OS
--===============1323038601==
Content-Type: text/html; charset=iso-8859-1; format=flowed
<html><div style='background-color:'><DIV class=RTE>
<P>Have you tried looking into the %ENV hash in each OS? There are generally particular keys and/or values that let you know where you are running.</P>
<P>HTH</P>
<P>Paco Zarabozo<BR><BR></P></DIV>
<DIV></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px"><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">
<HR color=#a0c6e5 SIZE=1>
<DIV></DIV>From: <I>Greg Schraiber <schraibg [at] beloit.edu></I><BR>To: <I>activeperl [at] listserv.ActiveState.com</I><BR>Subject: <I>determining OS</I><BR>Date: <I>Tue, 17 Jul 2007 15:55:09 -0500</I><BR>MIME-Version: <I>1.0</I><BR>Received: <I>from mx.activestate.com ([209.17.146.130]) by bay0-mc9-f20.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Tue, 17 Jul 2007 13:55:23 -0700</I><BR>Received: <I>from box14.activestate.com (unknown [192.168.70.104])by mx.activestate.com (Postfix) with ESMTP id B4D01A4601;Tue, 17 Jul 2007 13:55:06 -0700 (PDT)</I><BR>Received: <I>from beloit.edu (beloit.edu [144.89.40.1])by mx.activestate.com (Postfix) with ESMTP id 955DDA45D8for <activeperl [at] listserv.ActiveState.com>;Tue, 17 Jul 2007 13:55:03 -0700 (PDT)</I><BR>Received: <I>from
bcits5986.beloit.edu ([144.89.41.15])by beloit.edu (8.13.1/8.13.1) with ESMTP id l6HKt2bg001401for <activeperl [at] listserv.ActiveState.com>;Tue, 17 Jul 2007 15:55:02 -0500</I><BR>>Hi All!<BR>><BR>>I have a script (perl v5.8.5) that needs to run on both AIX and<BR>>linux. Does anyone have a code snippit that would allow the script<BR>>to determine which OS it is currently running under? Any help would<BR>>be greatly appreciated!<BR>><BR>>Thank you!<BR>>Greg<BR>><BR>><BR>>_______________________________________________<BR>>ActivePerl mailing list<BR>>ActivePerl [at] listserv.ActiveState.com<BR>>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs<BR></FONT></BLOCKQUOTE></div><br clear=all><hr>Tu horóscopo diario, semanal y gratuito. <a href="http://g.msn.com/8HMAESES/2728??PS=47575" target="_top">Cartas,
tarot y predicciones en MSN Horóscopo</a> </html>
--===============1323038601==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1323038601==--
Re: determining OS
--===============1638584652==
Content-Type: multipart/alternative;
boundary="----=_Part_71749_26686915.1184748243830"
------=_Part_71749_26686915.1184748243830
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi
You can try read the $^O variable:
print $^O; #Mine is MSWin32.
On 7/18/07, Paco Zarabozo A. <fzarabozo [at] hotmail.com> wrote:
>
> Have you tried looking into the %ENV hash in each OS? There are generall=
y
> particular keys and/or values that let you know where you are running.
>
> HTH
>
> Paco Zarabozo
>
> ------------------------------
> From: *Greg Schraiber <schraibg [at] beloit.edu>*
> To: *activeperl [at] listserv.ActiveState.com*
> Subject: *determining OS*
> Date: *Tue, 17 Jul 2007 15:55:09 -0500*
> MIME-Version: *1.0*
> Received: *from mx.activestate.com ([209.17.146.130]) by
> bay0-mc9-f20.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Tue,
> 17 Jul 2007 13:55:23 -0700*
> Received: *from box14.activestate.com (unknown [192.168.70.104])by
> mx.activestate.com (Postfix) with ESMTP id B4D01A4601;Tue, 17 Jul 2007
> 13:55:06 -0700 (PDT)*
> Received: *from beloit.edu (beloit.edu [144.89.40.1])by
> mx.activestate.com (Postfix) with ESMTP id 955DDA45D8for <
> activeperl [at] listserv.ActiveState.com>;Tue, 17 Jul 2007 13:55:03 -0700 (PDT=
)
> *
> Received: *from bcits5986.beloit.edu ([144.89.41.15])by beloit.edu (
> 8.13.1/8.13.1) with ESMTP id l6HKt2bg001401for <
> activeperl [at] listserv.ActiveState.com>;Tue, 17 Jul 2007 15:55:02 -0500*
> >Hi All!
> >
> >I have a script (perl v5.8.5) that needs to run on both AIX and
> >linux. Does anyone have a code snippit that would allow the script
> >to determine which OS it is currently running under? Any help would
> >be greatly appreciated!
> >
> >Thank you!
> >Greg
> >
> >
> >_______________________________________________
> >ActivePerl mailing list
> >ActivePerl [at] listserv.ActiveState.com
> >To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs<http://li=
stserv.activestate.com/mailman/mysubs>
>
>
> ------------------------------
> Tu hor=F3scopo diario, semanal y gratuito. Cartas, tarot y predicciones e=
n
> MSN Hor=F3scopo <http://g.msn.com/8HMAESES/2728??PS=3D47575>
> _______________________________________________
> ActivePerl mailing list
> ActivePerl [at] listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs<http://lis=
tserv.activestate.com/mailman/mysubs>
>
------=_Part_71749_26686915.1184748243830
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<div>Hi</div>
<div> </div>
<div>You can try read the $^O variable:</div>
<div> </div>
<div>print $^O; #Mine is MSWin32.<br><br> </div>
<div><span class=3D"gmail_quote">On 7/18/07, <b class=3D"gmail_sendername">=
Paco Zarabozo A.</b> <<a href=3D"mailto:fzarabozo [at] hotmail.com">fzarabozo=
[at] hotmail.com</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div>
<p>Have you tried looking into the %ENV hash in each OS? There are generall=
y particular keys and/or values that let you know where you are running.</p=
>
<p>HTH</p>
<p>Paco Zarabozo<br><br></p></div>
<div></div>
<blockquote style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c=
6e5 2px solid; MARGIN-RIGHT: 0px"><font style=3D"FONT-SIZE: 11px; FONT-FAMI=
LY: tahoma,sans-serif">
<hr color=3D"#a0c6e5" size=3D"1">
<div></div>From: <i>Greg Schraiber <<a onclick=3D"return top.=
js.OpenExtLink(window,event,this)" href=3D"mailto:schraibg [at] beloit.edu" targ=
et=3D"_blank">schraibg [at] beloit.edu</a>></i><br>To: <i><a oncli=
ck=3D"return top.js.OpenExtLink(window,event,this)" href=3D"mailto:activepe=
rl [at] listserv.ActiveState.com" target=3D"_blank">
activeperl [at] listserv.ActiveState.com</a></i><br>Subject: <i>deter=
mining OS</i><br>Date: <i>Tue, 17 Jul 2007 15:55:09 -0500</i><br=
>MIME-Version: <i>1.0</i><br>Received: <i>from <a onc=
lick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://mx.act=
ivestate.com/" target=3D"_blank">
mx.activestate.com</a> ([<a onclick=3D"return top.js.OpenExtLink(window,eve=
nt,this)" href=3D"http://209.17.146.130/" target=3D"_blank">209.17.146.130<=
/a>]) by <a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=
=3D"http://bay0-mc9-f20.bay0.hotmail.com/" target=3D"_blank">
bay0-mc9-f20.bay0.hotmail.com</a> with Microsoft SMTPSVC(6.0.3790.2668); Tu=
e, 17 Jul 2007 13:55:23 -0700</i><br>Received: <i>from <a onclic=
k=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://box14.act=
ivestate.com/" target=3D"_blank">
box14.activestate.com</a> (unknown [<a onclick=3D"return top.js.OpenExtLink=
(window,event,this)" href=3D"http://192.168.70.104/" target=3D"_blank">192.=
168.70.104</a>])by <a onclick=3D"return top.js.OpenExtLink(window,event,thi=
s)" href=3D"http://mx.activestate.com/" target=3D"_blank">
mx.activestate.com</a> (Postfix) with ESMTP id B4D01A4601;Tue, 17 Jul 2007 =
13:55:06 -0700 (PDT)</i><br>Received: <i>from <a onclick=3D"retu=
rn top.js.OpenExtLink(window,event,this)" href=3D"http://beloit.edu/" targe=
t=3D"_blank">
beloit.edu</a> (<a onclick=3D"return top.js.OpenExtLink(window,event,this)"=
href=3D"http://beloit.edu/" target=3D"_blank">beloit.edu</a> [<a onclick=
=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://144.89.40.=
1/" target=3D"_blank">
144.89.40.1</a>])by <a onclick=3D"return top.js.OpenExtLink(window,event,th=
is)" href=3D"http://mx.activestate.com/" target=3D"_blank">mx.activestate.c=
om</a> (Postfix) with ESMTP id 955DDA45D8for <<a onclick=3D"return top.j=
s.OpenExtLink(window,event,this)" href=3D"mailto:activeperl [at] listserv.Active=
State.com" target=3D"_blank">
activeperl [at] listserv.ActiveState.com</a>>;Tue, 17 Jul 2007 13:55:03 -0700=
(PDT)</i><br>Received: <i>from <a onclick=3D"return top.js.Open=
ExtLink(window,event,this)" href=3D"http://bcits5986.beloit.edu/" target=3D=
"_blank">bcits5986.beloit.edu
</a> ([<a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"=
http://144.89.41.15/" target=3D"_blank">144.89.41.15</a>])by <a onclick=3D"=
return top.js.OpenExtLink(window,event,this)" href=3D"http://beloit.edu/" t=
arget=3D"_blank">
beloit.edu</a> (8.13.1/8.13.1) with ESMTP id l6HKt2bg001401for <<a oncli=
ck=3D"return top.js.OpenExtLink(window,event,this)" href=3D"mailto:activepe=
rl [at] listserv.ActiveState.com" target=3D"_blank">activeperl [at] listserv.ActiveSt=
ate.com
</a>>;Tue, 17 Jul 2007 15:55:02 -0500</i><br>>Hi All!<br>><br>>=
I have a script (perl v5.8.5) that needs to run on both AIX and<=
br>>linux. Does anyone have a code snippit that would allow t=
he script<br>>to determine which OS it is currently running under? =
Any help would
<br>>be greatly appreciated!<br>><br>>Thank you!<br>>Greg<br>&g=
t;<br>><br>>_______________________________________________<br>>Ac=
tivePerl mailing list<br>><a onclick=3D"return top.js.OpenExtLink(window=
,event,this)" href=3D"mailto:ActivePerl [at] listserv.ActiveState.com" target=3D=
"_blank">
ActivePerl [at] listserv.ActiveState.com</a><br>>To unsubscribe: <a onclick=
=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://listserv.a=
ctivestate.com/mailman/mysubs" target=3D"_blank">http://listserv.ActiveStat=
e.com/mailman/mysubs
</a><br></font></blockquote></div><span class=3D"ad"><br clear=3D"all">
<hr>
Tu hor=F3scopo diario, semanal y gratuito. <a onclick=3D"return top.js.Open=
ExtLink(window,event,this)" href=3D"http://g.msn.com/8HMAESES/2728??PS=3D47=
575" target=3D"_blank">Cartas, tarot y predicciones en MSN Hor=F3scopo</a> =
</span>
<br>_______________________________________________<br>ActivePerl mailing l=
ist<br><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"=
mailto:ActivePerl [at] listserv.ActiveState.com">ActivePerl [at] lists erv.ActiveState=
..com
</a><br>To unsubscribe: <a onclick=3D"return top.js.OpenExtLink(window,even=
t,this)" href=3D"http://listserv.activestate.com/mailman/mysubs" target=3D"=
_blank">http://listserv.ActiveState.com/mailman/mysubs</a><br></blockquote>=
</div>
<br>
------=_Part_71749_26686915.1184748243830--
--===============1638584652==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1638584652==--
RE: determining OS
Greg Schraiber <> wrote:
> Hi All!
> =
> I have a script (perl v5.8.5) that needs to run on both AIX and
> linux. Does anyone have a code snippit that would allow the script
> to determine which OS it is currently running under? Any help would
> be greatly appreciated! =
As others have mentioned, $^O will probably be good enough to
distinguish between those OSs (see 'perldoc perlvar'). Run the following
command on each platform to tell you what to look for:
perl -e "print qq{$^O\n}"
If you need more detailed, or finer grained, platform dependent
information use the Config module (see 'perldoc Config').
HTH
-- =
Brian Raven =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Atos Euronext Market Solutions Disclaimer
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =
Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: determining OS
Thank you to all that responded. The variable $^O was exactly what I
was looking for.
Thanks again,
Greg
Hi All!
I have a script (perl v5.8.5) that needs to run on both AIX and
linux. Does anyone have a code snippit that would allow the script
to determine which OS it is currently running under? Any help would
be greatly appreciated!
Thank you!
Greg
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
=================================
Gregory J Schraiber
Information Services & Resources
608-363-2456 schraibg [at] beloit.edu
=================================
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs