<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>N.P's Scripts and OS Fundamentals</title>
	<atom:link href="http://niharscript.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://niharscript.wordpress.com</link>
	<description>The Missing Link</description>
	<lastBuildDate>Fri, 03 Oct 2008 05:44:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='niharscript.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>N.P's Scripts and OS Fundamentals</title>
		<link>http://niharscript.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://niharscript.wordpress.com/osd.xml" title="N.P&#039;s Scripts and OS Fundamentals" />
	<atom:link rel='hub' href='http://niharscript.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Ethernet</title>
		<link>http://niharscript.wordpress.com/2008/09/28/ethernet/</link>
		<comments>http://niharscript.wordpress.com/2008/09/28/ethernet/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 13:47:58 +0000</pubDate>
		<dc:creator>niharcsql</dc:creator>
				<category><![CDATA[NETWORKING]]></category>

		<guid isPermaLink="false">http://niharscript.wordpress.com/?p=54</guid>
		<description><![CDATA[A local area network (LAN) architecture developed by Xerox Corporation in cooperation with DEC and Intel 1976. Ethernet uses a bus or star topology and supports data transfer rates of 10 Mbps. The Ethernet specification served as the basis for the IEEE 802.3 standard, which specifies the physical and lower software layers. Ethernet uses the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=54&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A local area network (LAN) architecture developed by Xerox Corporation in cooperation with DEC and Intel 1976. Ethernet uses a bus or star topology and supports data transfer rates of 10 Mbps. The Ethernet specification served as the basis for the IEEE 802.3 standard, which specifies the physical and lower software layers. Ethernet uses the CSMA/CD access method to handle simultaneous demands. It is one of the most widely implemented LAN standards.</p>
<p>A newer version of Ethernet, called 100 Dase -T (or <em>Fast Ethernet),</em> supports data transfer rates of 100 Mbps. And the newest version, Gigabit Ethernet supports data rates of 1 gigabit(1,000 megabits) per second.</p>
<p>It is a<span> type of Local Area Network, which connects computers, printers, workstations etc using cable.</span><span>It specifies how data is placed on and retrieved from a common transmission medium.</span></p>
<p>I<span>t is a network protocol defining a specific implementation of the Physical and Data Link Layers in the OSI model (IEEE 802.3)</span></p>
<p>It is <span>one of the earliest and least expensive network types.It is </span><span>Is the most commonly used method of connecting LANs. It allows for network communication by using either coaxial or twisted pair cable.</span><span>Coaxial cable carries radio frequency signals between computers at a rate of 10 megabits per second.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niharscript.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niharscript.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niharscript.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niharscript.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/niharscript.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/niharscript.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/niharscript.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/niharscript.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niharscript.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niharscript.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niharscript.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niharscript.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niharscript.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niharscript.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=54&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://niharscript.wordpress.com/2008/09/28/ethernet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4051ee189f970200d2577aac6620d73?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Papu</media:title>
		</media:content>
	</item>
		<item>
		<title>CLUSTER</title>
		<link>http://niharscript.wordpress.com/2008/09/28/cluster/</link>
		<comments>http://niharscript.wordpress.com/2008/09/28/cluster/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 10:24:42 +0000</pubDate>
		<dc:creator>niharcsql</dc:creator>
				<category><![CDATA[Operating System]]></category>

		<guid isPermaLink="false">http://niharscript.wordpress.com/?p=30</guid>
		<description><![CDATA[Cluster In general Cluster is a group of the same or similar elements gathered or occurring closely together; In computer Terminology a cluster can refer to several machines grouped together, all performing a similar function. We can say in other way i.e. “Multiple systems performing a single function”. For example, a cluster may consist of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=30&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Liberation Sans,sans-serif;"><span style="font-size:medium;"><strong>Cluster</strong></span></span></p>
<p><span style="font-family:Liberation Sans,sans-serif;"> In general Cluster is a group of the same or similar elements gathered or occurring closely together;</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;"> In computer Terminology a cluster can  refer to several machines grouped together, all performing a similar function. We can say in other way i.e. “Multiple systems performing a single function”<span style="color:#ffffff;"><span style="text-decoration:none;"><span style="font-size:small;"><span style="font-style:normal;"><span>. </span></span></span></span></span> For example, a cluster may consist of eight PCs, all connected via high-speed <a href="http://niharscript.wordpress.com/2008/09/28/ethernet">Ethernet</a>, processing scientific data. This type of setup is often referred to as &#8220;parallel computing,&#8221; since all the computers in the cluster are acting as one machine. Clusters are typically used for high-end processing, such as performing scientific calculations or decrypting algorithms.</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;"><span style="font-size:medium;"><strong>Cluster applications</strong></span></span></p>
<p><span style="font-family:Liberation Sans,sans-serif;"><span style="font-size:small;"> For many types of computing problems related to high-throughput applications, it is possible to take advantage of the scalable performance of a cluster without changing the application.</span></span></p>
<p><span style="font-family:Liberation Sans,sans-serif;"> The main goal of a clustered environment is application <a href="http://niharscript.wordpress.com/resilient-applications">resilience </a>(Performance, Availability, Recoverability) . By taking advantage of resilient applications in your cluster, an application can be restarted on a different cluster node without requiring you to reconfigure the clients. In addition, the data that is associated with the application will be available after switchover or failover. This means that the application end user can experience minimal, or even seamless, interruption while the application and its data switch from the primary node to the backup node. The user does not need to know that the application and data have moved on the back end. For instance </span><span style="font-family:Liberation Sans,sans-serif;"><em>CSQL Cache is a high performance, bi-directional, updateable database caching infrastructure that sits between the clustered application process and back-end data sources to provide unprecedented high throughput to your application. </em></span><em><strong>Transparent Fail over</strong></em><em> in CSQL main memory database tells that </em><em>There should not be any service outages, incase of caching platform failure. Client connections should be routed to the target databas</em></p>
<p><span style="font-family:Liberation Sans,sans-serif;"> In order to achieve application resiliency in your cluster, applications that meet certain availability specifications must be used. Certain characteristics must be present in the application in order for it to be switchable, and therefore always available to the end users of the application in the cluster. Once you have a resilient application, it must be managed within your cluster. </span></p>
<p><strong>A Switchover</strong> is the capability to manually switch over from one system to a  redundant  or standby computer server, syatem, or network upon the failure or abnormal termination of the previously active server, system, or network. <strong>It</strong> happens <em><strong>with human intervention</strong></em><span style="font-family:Liberation Sans,sans-serif;">. <strong>It </strong>is is a planned role reversal between the production database and one of its standby databases to avoid downtime during scheduled maintenance on the production system or to test readiness for future role transitions. A switchover guarantees no data loss. During a switchover, the production database transitions to  standby role, and the standby  database transitions to the production role. The transition occurs without having to restart either database. A switchover is performed by an administrator through either Enterprise Manager or by issuing SQL commands.</span></p>
<p><strong>A Failover </strong>is the capability to switch over automatically to a redundant or standby computer server, system, or network upon the failure or abnormal termination of the previously active server, system, or network. Failover happens <strong><em>without human intervention</em></strong> and generally <strong><em>without warning</em></strong><span style="font-family:Liberation Sans,sans-serif;">.<strong> It </strong>is performed when the production database fails and one of the standby databases is transitioned to take over the production role, allowing business operations to continue. </span><strong><em></em></strong><span style="font-family:Liberation Sans,sans-serif;"> Once the failover is complete and applications have resumed, the administrative staff can turn its attention to resolving the problems with the failed system. Failover may or may not result in data loss depending on the protection mode in effect at the time of the failover.</span><br />
<span style="font-family:Liberation Sans,sans-serif;"> </span></p>
<p><span style="font-family:Liberation Sans,sans-serif;">In Distributed Database system Both Data and their functionalities are spread accross nodes ; each machine has part of data. All nodes must have access over data. Synchronization between the systems is established, so that in case one node fails other takes over. In replicated system Data replicated at the server level (Network), or at the storage level; Multiple copies of the same database is maintained.</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;"><strong>Two categories of failovers are there</strong></span></p>
<ol>
<li><span style="font-family:Liberation Sans,sans-serif;">Active/Passive 	failover</span></li>
<li><span style="font-family:Liberation Sans,sans-serif;">Active/Active  	failover</span></li>
</ol>
<p><span style="font-family:Liberation Sans,sans-serif;"><span style="font-size:small;"><span style="text-decoration:underline;">Active/Passive failover</span></span></span></p>
<p><span style="font-family:Liberation Sans,sans-serif;">-&gt; One node is active</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;">-&gt; The other is passive until fail over</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;"><span style="font-size:small;"><span style="text-decoration:underline;">Active/Active failover</span></span></span></p>
<p><span style="font-family:Liberation Sans,sans-serif;">-&gt; 2 separate databases are involved</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;">-&gt; One is active on node A and passive on node B</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;">-&gt; The second is active on node B and passive on node A</span></p>
<p><span style="font-family:Liberation Sans,sans-serif;">-&gt; Separate applications and user connections to each of the different databases.</span></p>
<h2><span style="font-family:Liberation Sans,sans-serif;">Efficient cluster application</span></h2>
<p><span style="font-family:Liberation Sans,sans-serif;">An efficient application is one that can be resilient to a system outage in a clustered environment. Several levels of application availability are possible:</span></p>
<ol>
<li>
<p style="margin-bottom:0;"><span style="font-family:Liberation Sans,sans-serif;">If 	an application error occurs, the application restarts itself on the 	same node and corrects any potential cause for error (such as 	corrupt control data). You would view the application as though it 	had started for the first time. </span></p>
</li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Liberation Sans,sans-serif;">The 	application performs some amount of checkpoint-restart processing. 	You would view the application as if it were close to the point of 	failure. </span></p>
</li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Liberation Sans,sans-serif;">If 	a system outage occurs, the application is restarted on a backup 	server. You would view the application as though it had started for 	the first time. </span></p>
</li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Liberation Sans,sans-serif;">If 	a system outage occurs, the application is restarted on a backup 	server and performs some amount of checkpoint-restart processing 	across the servers. You would view the application as if it were 	close to the point of failure. </span></p>
</li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Liberation Sans,sans-serif;">If 	a system outage occurs, a coordinated failover of both the 	application and its associated data to another node or nodes in the 	cluster would take place. You would view the application as though 	it had started for the first time. </span></p>
</li>
<li><span style="font-family:Liberation Sans,sans-serif;">If a system outage 	occurs, a coordinated failover of both the application and its 	associated data to another node or nodes in the cluster would take 	place. The application performs some amount of checkpoint-restart 	processing across the servers. You would view the application as if 	it were close to the point of failure.</span></li>
</ol>
<p><a href="http://niharscript.wordpress.com/2008/09/28/ethernet/"></a><a href="http://niharscript.wordpress.com/resilient-applications/"></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niharscript.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niharscript.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niharscript.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niharscript.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/niharscript.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/niharscript.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/niharscript.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/niharscript.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niharscript.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niharscript.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niharscript.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niharscript.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niharscript.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niharscript.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=30&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://niharscript.wordpress.com/2008/09/28/cluster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4051ee189f970200d2577aac6620d73?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Papu</media:title>
		</media:content>
	</item>
		<item>
		<title>scope of variables</title>
		<link>http://niharscript.wordpress.com/2008/09/26/scope-of-variables/</link>
		<comments>http://niharscript.wordpress.com/2008/09/26/scope-of-variables/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 11:15:22 +0000</pubDate>
		<dc:creator>niharcsql</dc:creator>
				<category><![CDATA[Operating System]]></category>

		<guid isPermaLink="false">http://niharscript.wordpress.com/?p=17</guid>
		<description><![CDATA[Open a terminal and Run the command $ MYVAR=hello Create a file named EX1.sh and add the following contents in the file #!/bin/sh echo "MYVAR is: $MYVAR" MYVAR="hi there" echo "MYVAR is: $MYVAR" Run the script $./EX1.sh OUTPUT: MYVAR is: MYVAR is: hi there What is happening here? When you call EX1.sh from your interacvive [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=17&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span>Open a terminal and Run the command</span><strong> </strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$ MYVAR=hello</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">Create a file named <span style="background:#00ffff none repeat scroll 0;">EX1.sh</span> and add the following contents in the file</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">#!/bin/sh</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">echo "MYVAR is: $MYVAR"</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">MYVAR="hi there"</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">echo "MYVAR is: $MYVAR"</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">Run the script</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$./EX1.sh</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>OUTPUT:</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is:</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is: hi there</em></span></span>

<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">What is happening here?</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">When you call EX1.sh from your interacvive shell, a new shell is worked to run the script.this is partly becoz of the
 #/bin/sh line at the begining of the script, We need to export the variable for itto be inherited by another program.</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">Run the following command</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$ export MYVAR</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$ ./EX1.sh</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>OUTPUT</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is: hello</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is: hi there</em></span></span></pre>
<p style="margin-bottom:0;"><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">Now in the 1</span></span><sup><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">st</span></span></sup><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"> line of the output, the value of MYVAR is “hello” But there is no way that this will be passed back to your interactive shell. Try reading the value of </span></span><code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">MYVAR</span></span></code></p>
<pre><code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$ echo $MYVAR</strong></span></span></code>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>hello</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$</strong></span></span></pre>
<p style="margin-bottom:.2in;"><code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span>Once the shell script exits, its environment is destroyed. But MYVAR keeps its value of hello within your interactive shell. In order to receive environment changes back from the script, we must </span></span></span></code><code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em><span>source</span></em></span></span></code><code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span> the script - this effectively runs the script within our own interactive shell, instead of spawning another shell to run it. We can source a script via the "." command:</span></span></span></code></p>
<pre style="margin-bottom:.2in;"><code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span>Open another Terminal and run the following command</span></span></span></code>
<code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span>$</span></span></span></code><code><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong> MYVAR=hello</strong></span></span></code>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$ echo $MYVAR</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">OUTPUT:</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>hello</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$ . ./EX1.sh</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is: hello</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is: hi there</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$ echo $MYVAR</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">hi there</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">In the above command MYVAR variable just inherits the value of MYVAR from Global scope temporarily.
This will not affect other files(What was happened using export command. </span></span><span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">create another file named <span style="background:#00ffff none repeat scroll 0;">EX2.sh</span>
and add the following instructions</span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">#!/bin/sh</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">echo "MYVAR is: $MYVAR"</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">MYVAR="hi there"</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><span style="background:#ffff00 none repeat scroll 0;">echo "MYVAR is: $MYVAR"</span></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">Run the script.See What happens</span></span>

<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><strong>$./EX2.sh</strong></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>OUTPUT:</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is:</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;"><em>MYVAR is: hi there</em></span></span>
<span style="font-family:Liberation Serif,serif;"><span style="font-size:small;">we are using the same variable in EX2.sh, But it is not displaying the value of the Global variable MYVAR.
It displaying the empty value.</span></span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niharscript.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niharscript.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niharscript.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niharscript.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/niharscript.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/niharscript.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/niharscript.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/niharscript.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niharscript.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niharscript.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niharscript.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niharscript.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niharscript.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niharscript.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=17&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://niharscript.wordpress.com/2008/09/26/scope-of-variables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4051ee189f970200d2577aac6620d73?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Papu</media:title>
		</media:content>
	</item>
		<item>
		<title>SCOPE of Variables</title>
		<link>http://niharscript.wordpress.com/2008/09/26/environment-variable-setting-through-using-export-command/</link>
		<comments>http://niharscript.wordpress.com/2008/09/26/environment-variable-setting-through-using-export-command/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 08:29:46 +0000</pubDate>
		<dc:creator>niharcsql</dc:creator>
				<category><![CDATA[Operating System]]></category>
		<category><![CDATA[CLUSTER]]></category>

		<guid isPermaLink="false">http://niharscript.wordpress.com/?p=3</guid>
		<description><![CDATA[SETTING ENVIRONMENT VARIABLES by the help of export command Normally all our variables are local. Local variable can be used in same shell, if you load another copy of shell (by typing the /bin/bash at the $ prompt) then new shell ignored all old shell&#8217;s variable. For e.g. Consider following example $ myvar=NIHAR $ echo [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=3&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>SETTING ENVIRONMENT VARIABLES by the help of <em><strong>export</strong></em> command</strong></p>
<p>Normally all our variables are local. Local variable can be used in same shell, if you load another copy of shell (by typing the <strong>/bin/bash</strong> at the $ prompt) then new shell ignored all old shell&#8217;s variable. For e.g. Consider following example</p>
<p><strong>$ myvar=NIHAR</strong><br />
<strong>$ echo $myvar</strong><br />
<em>NIHAR</em><br />
<strong>$ /bin/bash<br />
$ echo $myvar </strong></p>
<p><strong>NOTE</strong>:-Empty line printed<br />
This is due to the variable &#8216;myvar&#8217; has only scope to the previous SHELL. That has the value &#8220;NIHAR&#8221; which has no scope to the /bin/bash SHELL. As there is no value assigned to the variable &#8216;myvar&#8217; it shows the value of &#8216;myvar&#8217; as empty. This can be solved by the export command<br />
<strong>$ myvar=Papu<br />
$ echo $myvar</strong><br />
<em>Papu</em><br />
<strong>$ exit<br />
$ echo $myvar</strong><br />
<em>NIHAR</em></p>
<p>Global shell defined as:<br />
You can copy old shell&#8217;s variable to new shell (i.e. first shells variable to seconds shell), such variable is know as Global Shell variable.</p>
<p>To set global varible you have to use export command.<br />
<em>Syntax: </em><br />
$ export variable1, variable2,&#8230;..variableN</p>
<p><em>Examples:</em><br />
<strong>$ myvar=NIHAR<br />
$ echo $myvar<br />
</strong><em>NIHAR</em><br />
<strong>$ export myvar<br />
$ /bin/bash<br />
$ echo $myvar<br />
</strong><em>NIHAR</em><br />
<strong>$ exit<br />
$ echo $myvar</strong><br />
<em>Nihar</em></p>
<p>Here one problem is arising. The export command set the value of &#8216;myvar&#8217; for all SHELLs. That means the value of variable &#8216;myvar&#8217; will have the same value in each SHELL . Suppose we do not want to see the same value of the variable &#8216;myvar&#8217; in another SHELL <a href="http://niharscript.wordpress.com/2008/09/26/scope-of-variables/">what can be done?</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niharscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niharscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niharscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niharscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/niharscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/niharscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/niharscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/niharscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niharscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niharscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niharscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niharscript.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niharscript.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niharscript.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niharscript.wordpress.com&amp;blog=4985635&amp;post=3&amp;subd=niharscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://niharscript.wordpress.com/2008/09/26/environment-variable-setting-through-using-export-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f4051ee189f970200d2577aac6620d73?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Papu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
