<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://knowledge.pinon-hebert.fr/mediawiki/index.php?action=history&amp;feed=atom&amp;title=If_en_bash</id>
	<title>If en bash - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://knowledge.pinon-hebert.fr/mediawiki/index.php?action=history&amp;feed=atom&amp;title=If_en_bash"/>
	<link rel="alternate" type="text/html" href="https://knowledge.pinon-hebert.fr/mediawiki/index.php?title=If_en_bash&amp;action=history"/>
	<updated>2026-05-19T18:10:39Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://knowledge.pinon-hebert.fr/mediawiki/index.php?title=If_en_bash&amp;diff=1681&amp;oldid=prev</id>
		<title>Jpinon le 7 décembre 2025 à 16:10</title>
		<link rel="alternate" type="text/html" href="https://knowledge.pinon-hebert.fr/mediawiki/index.php?title=If_en_bash&amp;diff=1681&amp;oldid=prev"/>
		<updated>2025-12-07T16:10:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 7 décembre 2025 à 16:10&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Ligne 17 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 17 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|+Attention&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|+Attention&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|[[Fichier:Attention.png|sans_cadre|53x53px]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|[[Fichier:Attention.png|sans_cadre|53x53px]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;POur &lt;/del&gt;ceux qui font du perl c&#039;est exactement l&#039;inverse. == pour les chaines et eq pour les nombres.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Pour &lt;/ins&gt;ceux qui font du perl c&#039;est exactement l&#039;inverse. == pour les chaines et eq pour les nombres.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key knowledge:diff:1.41:old-1680:rev-1681:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Jpinon</name></author>
	</entry>
	<entry>
		<id>https://knowledge.pinon-hebert.fr/mediawiki/index.php?title=If_en_bash&amp;diff=1680&amp;oldid=prev</id>
		<title>Jpinon : Page créée avec « J&#039;oublie toujours comment on fait un IF en bash. Je ne dois pas le faire assez souvent et, de plus c&#039;est assez exotique.  Le cas typique est le test d&#039;un code retour:&lt;syntaxhighlight lang=&quot;bash&quot;&gt; cat file.txt  if  $? == 0 ; then    echo &quot;success $?&quot; elif  $? == 1 ; then    echo &quot;error $?&quot; else    echo &quot;very strange error $?&quot; fi &lt;/syntaxhighlight&gt;Attention aux espaces dans la clause &lt;code&gt; &lt;/code&gt; il doit y en avoir après &lt;code&gt;&lt;/code&gt; et avant &lt;cod... »</title>
		<link rel="alternate" type="text/html" href="https://knowledge.pinon-hebert.fr/mediawiki/index.php?title=If_en_bash&amp;diff=1680&amp;oldid=prev"/>
		<updated>2025-12-07T16:10:10Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « J&amp;#039;oublie toujours comment on fait un IF en bash. Je ne dois pas le faire assez souvent et, de plus c&amp;#039;est assez exotique.  Le cas typique est le test d&amp;#039;un code retour:&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; cat file.txt  if &lt;a href=&quot;/mediawiki/index.php?title=$%3F_%3D%3D_0&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;$? == 0 (page inexistante)&quot; data-bs-title=&quot;$?_==_0&quot;&gt;$? == 0 &lt;/a&gt;; then    echo &amp;quot;success $?&amp;quot; elif &lt;a href=&quot;/mediawiki/index.php?title=$%3F_%3D%3D_1&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;$? == 1 (page inexistante)&quot; data-bs-title=&quot;$?_==_1&quot;&gt;$? == 1 &lt;/a&gt;; then    echo &amp;quot;error $?&amp;quot; else    echo &amp;quot;very strange error $?&amp;quot; fi &amp;lt;/syntaxhighlight&amp;gt;Attention aux espaces dans la clause &amp;lt;code&amp;gt;[[ ]]&amp;lt;/code&amp;gt; il doit y en avoir après &amp;lt;code&amp;gt;&amp;lt;/code&amp;gt; et avant &amp;lt;cod... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;J&amp;#039;oublie toujours comment on fait un IF en bash. Je ne dois pas le faire assez souvent et, de plus c&amp;#039;est assez exotique.&lt;br /&gt;
&lt;br /&gt;
Le cas typique est le test d&amp;#039;un code retour:&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cat file.txt&lt;br /&gt;
&lt;br /&gt;
if [[ $? == 0 ]]; then&lt;br /&gt;
   echo &amp;quot;success $?&amp;quot;&lt;br /&gt;
elif [[ $? == 1 ]]; then&lt;br /&gt;
   echo &amp;quot;error $?&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
   echo &amp;quot;very strange error $?&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Attention aux espaces dans la clause &amp;lt;code&amp;gt;[[ ]]&amp;lt;/code&amp;gt; il doit y en avoir après &amp;lt;code&amp;gt;[[&amp;lt;/code&amp;gt; et avant &amp;lt;code&amp;gt;]]&amp;lt;/code&amp;gt; mais aussi autour des opérateurs (ici &amp;lt;code&amp;gt;==&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Les opérateurs sont les classiques &amp;lt;code&amp;gt;==&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;!=&amp;lt;/code&amp;gt;,  &amp;lt;code&amp;gt;&amp;lt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;gt;=&amp;lt;/code&amp;gt;, et &amp;lt;code&amp;gt;&amp;lt;=&amp;lt;/code&amp;gt; pour ce qui est de nombres et  &amp;lt;code&amp;gt;-eq&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-ne&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-lt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-le&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-gt&amp;lt;/code&amp;gt; et &amp;lt;code&amp;gt;-ge&amp;lt;/code&amp;gt;, pour leur équivalant en &amp;quot;string&amp;quot;. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Attention&lt;br /&gt;
|[[Fichier:Attention.png|sans_cadre|53x53px]]&lt;br /&gt;
|POur ceux qui font du perl c&amp;#039;est exactement l&amp;#039;inverse. == pour les chaines et eq pour les nombres.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jpinon</name></author>
	</entry>
</feed>