<?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/"
	>

<channel>
	<title>Elias Medawar&#039;s Blog</title>
	<atom:link href="http://medawar.org/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://medawar.org/blog</link>
	<description></description>
	<lastBuildDate>Mon, 17 Jan 2011 12:47:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>BASH Aliases MAC OS</title>
		<link>http://medawar.org/blog/?p=23</link>
		<comments>http://medawar.org/blog/?p=23#comments</comments>
		<pubDate>Sat, 15 Jan 2011 14:18:33 +0000</pubDate>
		<dc:creator>Elias Medawar</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://medawar.org/blog/?p=23</guid>
		<description><![CDATA[L&#8217;utilité des alias dans le terminal n&#8217;est plus à prouver, cependant c&#8217;est toujours embêtant de devoir changer soit même les alias en éditant à la main le .bash_profile ou le .bashrc. Pour facilité cette opération voici trois fonctions qui peuvent être utile. En tout cas à moi elles me servent beaucoup. # Fonction d'ajout ou [...]]]></description>
			<content:encoded><![CDATA[<p><em>
<p>L&#8217;utilité des alias dans le terminal n&#8217;est plus à prouver, cependant c&#8217;est toujours embêtant de devoir changer soit même les alias en éditant à la main le .bash_profile ou le .bashrc. Pour facilité cette opération voici trois fonctions qui peuvent être utile. En tout cas à moi elles me servent beaucoup. </p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #666666; font-style: italic;"># Fonction d'ajout ou de remplacement d'un alias existant</span>
  <span style="color: #666666; font-style: italic;"># param 1 = nom de l'alias</span>
  <span style="color: #666666; font-style: italic;"># param 2 = &quot;comande à executer&quot;</span>
  <span style="color: #666666; font-style: italic;"># exemple: addAlias la &quot;ls -a&quot; </span>
  <span style="color: #000000; font-weight: bold;">function</span> addAlias <span style="color: #7a0874; font-weight: bold;">&#123;</span> 
      dellAlias $<span style="color: #000000;">1</span>;
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #7a0874; font-weight: bold;">alias</span> $<span style="color: #000000;">1</span>=<span style="color: #000000; font-weight: bold;">\&quot;</span>$<span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">\&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span>~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile
      <span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile
  <span style="color: #7a0874; font-weight: bold;">&#125;</span>
  <span style="color: #666666; font-style: italic;"># Fonction d'ajout ou de remplacement d'un alias existant</span>
  <span style="color: #666666; font-style: italic;"># param 1 = nom de l'alias existant</span>
  <span style="color: #666666; font-style: italic;"># exemple: dellAlias la</span>
  <span style="color: #000000; font-weight: bold;">function</span> dellAlias <span style="color: #7a0874; font-weight: bold;">&#123;</span>
     <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot; (sed '/alias $1/d' &lt; ~/.bash_profile) &quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.Tbash ;
     <span style="color: #c20cb9; font-weight: bold;">cat</span> ~<span style="color: #000000; font-weight: bold;">/</span>.Tbash <span style="color: #000000; font-weight: bold;">&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile;
     <span style="color: #c20cb9; font-weight: bold;">rm</span> ~<span style="color: #000000; font-weight: bold;">/</span>.Tbash;
  <span style="color: #7a0874; font-weight: bold;">&#125;</span>
  <span style="color: #666666; font-style: italic;">#Fonction d'affichage des alias existant</span>
  <span style="color: #000000; font-weight: bold;">function</span> al <span style="color: #7a0874; font-weight: bold;">&#123;</span>
      <span style="color: #c20cb9; font-weight: bold;">grep</span> ^<span style="color: #7a0874; font-weight: bold;">alias</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/alias//'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/=/-&gt;/'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span>;
   <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

</p>
<p>Voilà j&#8217;espère que ces fonctions pourront vous êtres utile. </p>
]]></content:encoded>
			<wfw:commentRss>http://medawar.org/blog/?feed=rss2&#038;p=23</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

