<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=347101&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / nouveau problème de code]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=347101</link>
		<description><![CDATA[Les sujets les plus récents dans nouveau problème de code.]]></description>
		<lastBuildDate>Fri, 09 Oct 2009 14:20:54 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974573#p2974573</link>
			<description><![CDATA[<p>Non ça ne marche pas non plus</p><div class="codebox"><pre class="vscroll"><code>#!/bin/sh
case $# in
 0) echo &quot;il manque deux arguments&quot;
   echo -n &quot;entrer le premier argument :$nb1&quot;
   read nb1
   echo -n &quot;entrer le deuxième argument :$nb2 &quot;
   read nb2
   ;;
 1)nb1=$1
   echo -n &quot;il manque un argument,entrez votre nombre :$nb2 &quot;
   read nb2
   ;;
   2)nb1=$1
   nb2=$2
   ;;
 *)echo &quot;il y a trop d&#039;arguments veuillez recommencer&quot;
   exit

esac

if [ &quot;$(echo $nb? | grep &quot;^[0-1]*$&quot;)&quot; ]; then
    echo &quot;fournissez seulement un nombre, veuillez reesayer&quot;
    exit

elif [ $nb1 -lt $nb2 ]; then
   echo &quot;$nb1 inferieur a $nb2&quot; 
elif [ $nb1 -gt $nb2 ]; then

   echo &quot;$nb2 inferieur a $nb1&quot;
else
   echo &quot;$nb1 est egal a $nb2&quot;
fi</code></pre></div><p>ça me met les $(&#160; ) en surligné dans le code ?</p><p>if [ &quot;$(echo $nb? | grep &quot;^[0-1]*$&quot;)&quot; ]; then<br />&#160; &#160; echo &quot;fournissez seulement un nombre, veuillez reesayer&quot;<br />&#160; &#160; exit</p><p>ça serait les paranthèses qui seraientt pas au bon endroit ?</p>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Fri, 09 Oct 2009 14:20:54 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974573#p2974573</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974157#p2974157</link>
			<description><![CDATA[<div class="quotebox"><cite>yanick_cangaeld a écrit&#160;:</cite><blockquote><div><p>Pourquoi ça ne fonctionne pas avec ce code ?</p><p>if [ &quot;$(echo $nb | grep &quot;^[<strong>0-1</strong>]*$&quot;)&quot; ]; then<br />&#160; &#160; echo &quot;fournissez seulement un nombre, veuillez reesayer&quot;<br />&#160; &#160; exit <br />fi</p></div></blockquote></div>]]></description>
			<author><![CDATA[dummy@example.com (loutre)]]></author>
			<pubDate>Fri, 09 Oct 2009 10:42:28 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974157#p2974157</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974151#p2974151</link>
			<description><![CDATA[<p>Pourquoi les chiffres ? c&#039;est plutôt les lettres que je n&#039;autorise pas ? Je comprends pas <img src="http://forum.ubuntu-fr.org/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Fri, 09 Oct 2009 10:38:32 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974151#p2974151</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974143#p2974143</link>
			<description><![CDATA[<p>tout simplement parceque tu n&#039;autorises pas les chiffres <img src="http://forum.ubuntu-fr.org/img/smilies/roll.png" width="15" height="15" alt="roll" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Totor)]]></author>
			<pubDate>Fri, 09 Oct 2009 10:33:48 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974143#p2974143</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974051#p2974051</link>
			<description><![CDATA[<p>Pourquoi ça ne fonctionne pas avec ce code ?</p><p>if [ &quot;$(echo $nb | grep &quot;^[0-1a-zA-Z]*$&quot;)&quot; ]; then<br />&#160; &#160; echo &quot;fournissez seulement un nombre, veuillez reesayer&quot;<br />&#160; &#160; exit <br />fi</p><p>ça devrait bien refuser les caractères non numériques ?</p>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Fri, 09 Oct 2009 09:13:42 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2974051#p2974051</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2960729#p2960729</link>
			<description><![CDATA[<p>Heu.. oui ça fonctionne désolé .C&#039;est pour un autre code que ça ne fonctionne pas :</p><div class="codebox"><pre class="vscroll"><code>#!/bin/sh
case $# in
 0) echo &quot;il manque deux arguments&quot;
   Echo -n &quot;entrer le premier argument :$nb1&quot;
   read nb1
   echo -n &quot;entrer le deuxième argument :$nb2 &quot;
   read nb2
   ;; 
 1)nb1=$1
   Echo -n &quot;il manque un argument,entrez votre nombre :$nb2 &quot;
   read nb2
   ;;
 2)nb1=$1
   nb2=$2
   ;;
 *)echo &quot;trop d\&#039;arguments veuillez réessayer&quot;
   exit   
esac

if [ &quot;$(echo $nb | grep &quot;^[0-1a-zA-Z]*$&quot;)&quot; ]; then
    echo &quot;fournissez seulement un nombre, veuillez reesayer&quot;
    exit 
fi

if [ $nb1 -lt $nb2 ]; then
   echo &quot;$1 inferieur a $2&quot; 
elif [ $nb1 -gt $nb2 ]; then
   echo &quot;$nb2 inferieur a $nb1&quot;
else
   echo « $nb1 est egal a $nb2&quot;
fi</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Sat, 03 Oct 2009 09:07:15 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2960729#p2960729</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2960705#p2960705</link>
			<description><![CDATA[<p>Bah il fonctionne chez moi <img src="http://forum.ubuntu-fr.org/img/smilies/hmm.png" width="15" height="15" alt="hmm" /></p>]]></description>
			<author><![CDATA[dummy@example.com (nochka85)]]></author>
			<pubDate>Sat, 03 Oct 2009 08:55:08 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2960705#p2960705</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2960582#p2960582</link>
			<description><![CDATA[<p>En fait ça ne fonctionne pas complètement</p><p>ça m&#039;affiche illegal number et ça exécute le programme ensuite ,ça ne m&#039;affiche pas&#160; &#039;fournissez seulement un nombre&#039;</p><p>Que dois je faire pour que le code fonctionne correctement ?</p>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Sat, 03 Oct 2009 07:22:00 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2960582#p2960582</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2959270#p2959270</link>
			<description><![CDATA[<p>Je te remercie Nochka ça fonctionne effectivement <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Pourquoi tu me demandes ça Fruit ?</p>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Fri, 02 Oct 2009 13:13:53 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2959270#p2959270</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2959080#p2959080</link>
			<description><![CDATA[<p>Tu nous diras combien t&#039;as eu...</p>]]></description>
			<author><![CDATA[dummy@example.com (FRUiT)]]></author>
			<pubDate>Fri, 02 Oct 2009 11:44:26 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2959080#p2959080</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958972#p2958972</link>
			<description><![CDATA[<p>çà ne marche pas chez moi -&gt; si je lui écrit &quot;toto&quot;, il me répond que toto est pair <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p><br /><p>Moi je ferais çà (mais y&#039;a surement plus propre) :</p><div class="codebox"><pre><code>#!/bin/sh
case $# in
  0)echo -n &quot;fournissez moi un nombre s&#039;il vous plait :$nb&quot;
    nb=$1
    read nb;;
  1)nb=$1
   ;;
esac

if [ &quot;$(echo $nb | grep &quot;^[0-1a-zA-Z]*$&quot;)&quot; ]; then
	echo &quot;fournissez seulement un nombre, veuillez reesayer&quot;
	exit 
fi

res=$(($nb%2))
if [ $res -eq 0 ]; then
    echo &quot;le nombre $nb est pair&quot;
else echo &quot;le nombre $nb est impair&quot;
fi</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (nochka85)]]></author>
			<pubDate>Fri, 02 Oct 2009 10:45:36 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958972#p2958972</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958926#p2958926</link>
			<description><![CDATA[<p>Ben mon dernier cas demande bien de réessayer la frappe d&#039;un nombre ? Pourquoi tu dis que ça marche pas ?</p>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Fri, 02 Oct 2009 10:16:51 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958926#p2958926</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958898#p2958898</link>
			<description><![CDATA[<p>oui !</p><p>Exemple (tu peux essayer dans un terminal):</p><div class="codebox"><pre><code>$ echo 1+2
1+2
$ echo $(1+2)
bash: 1+2 : commande introuvable

$ echo $((1+2))
3</code></pre></div><p><img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>D&#039;ailleurs ton dernier cas ( *)echo &quot;fournissez seulement un nombre,veuillez reesayer&quot; ) ne marche pas <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[dummy@example.com (nochka85)]]></author>
			<pubDate>Fri, 02 Oct 2009 10:00:15 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958898#p2958898</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958892#p2958892</link>
			<description><![CDATA[<p>ça fonctionne parfaitement je te remercie <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>Mais pourquoi mettre 2 parenthèses ? res=$(($nb%2))<br />On est obligé de faire ainsi ?</p>]]></description>
			<author><![CDATA[dummy@example.com (yanick_cangaeld)]]></author>
			<pubDate>Fri, 02 Oct 2009 09:55:30 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958892#p2958892</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  nouveau problème de code]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958881#p2958881</link>
			<description><![CDATA[<p>Tu as oublié l&#039;espace entre le<strong> if</strong> et le<strong> [ $res -eq 0 ]; then</strong> <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>De plus, ta ligne <strong> res=$nb%2</strong> est fausse et mal placée : pour faire un calcul, tu dois le mettre entre <strong>$((</strong> et <strong>))</strong>... ce qui te donne donc : <strong>res=$(($nb%2))</strong></p><p>... et cette ligne est donc mal placé car elle ne s&#039;effectue que dans le cas ou tu fournit un argument ... donc, tu dois la sortir de ton case <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><br /><p>Ce qui donne donc ceci :</p><br /><div class="codebox"><pre><code>#!/bin/sh
case $# in
  0)echo -n &quot;fournissez moi un nombre s&#039;il vous plait :$nb&quot;
    nb=$1
    read nb;;
  1)nb=$1
   ;;
  *)echo &quot;fournissez seulement un nombre,veuillez reesayer&quot;
    exit
esac
res=$(($nb%2))
if [ $res -eq 0 ]; then
    echo &quot;le nombre $nb est pair&quot;
else echo &quot;le nombre $nb est impair&quot;
fi</code></pre></div><p><strong>EDIT :</strong> Ah oui, j&#039;oubliais : pour tes echo, $1 ne marche que si tu fournit un argument aussi ... c&#039;est pourquoi tu dois le remplacer par $nb <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[dummy@example.com (nochka85)]]></author>
			<pubDate>Fri, 02 Oct 2009 09:47:51 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=2958881#p2958881</guid>
		</item>
	</channel>
</rss>
