<?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=377108&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / comptage de dossier et calcul de moyenne]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=377108</link>
		<description><![CDATA[Les sujets les plus récents dans comptage de dossier et calcul de moyenne.]]></description>
		<lastBuildDate>Sun, 07 Feb 2010 16:17:06 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3264626#p3264626</link>
			<description><![CDATA[<p>Concernant mon calcul de moyenne j&#039;ai fait ceci :</p><div class="codebox"><pre><code>#!/bin/bash

chiffres=0 					# initialisation des variables
moyenne=0
i=0

 until [ $chiffres -lt 0 ] 			# test de $chiffres &lt; 0
 do
    echo &quot;Entrez un chiffre puis ENTER pour entrer le chiffre suivant (tapez q puis ENTER pour calculer la moyenne) : &quot;
    read chiffres 				# les nombres sont &quot;stocker&quot; dans $chiffres
    if [ $chiffres = &quot;q&quot; ] 			# test de $chiffres pour verifier l&#039;execution du calcul
    then
        chiffres=-1				# si calcul demande, mise a -1 de chiffres

    fi
    
   if [ $chiffres -ge 0 ]			# test de $chiffres &gt;= 0
   then
   let moyenne=$moyenne+$chiffres 		# ajouts des nombres contenu dans $chiffres
   let i=$i+1					# incrementation d&#039;un compteur qui calcul le nombre de chiffres total
   fi
 done

let moyenne=$moyenne/$i				# calcul de la moyenne
echo &quot;La moyenne est de $moyenne&quot;</code></pre></div><p>- Celà fonctionne mais m&#039;oblige à utiliser des nombres entiers...pour y remédier je sais que l&#039;on peut utiliser scale=1 ou bc -l mais je n&#039;arrive pas à placer ces commandes correctement quelqu&#039;un peut m&#039;aider?<br />- J&#039;ai peut être rendu complexe ma solution, avez vous des améliorations à me proposer?</p><p><em>edit modo : balises code</em></p>]]></description>
			<author><![CDATA[dummy@example.com (mega-jp)]]></author>
			<pubDate>Sun, 07 Feb 2010 16:17:06 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3264626#p3264626</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259521#p3259521</link>
			<description><![CDATA[<p><em>edit modo : merci de respecter les <a href="./misc.php?action=rules">règles du forum</a> : ne pas polluer le fil de discussion des autres et respecter les catégories du forum. Ouvre ton propre fil dans la <a href="./index.php">catégorie adaptée</a>.<br />ps. Pose également tes questions de façon plus explicite.</em></p>]]></description>
			<author><![CDATA[dummy@example.com (mohus)]]></author>
			<pubDate>Fri, 05 Feb 2010 13:34:11 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259521#p3259521</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259450#p3259450</link>
			<description><![CDATA[<div class="quotebox"><cite>nesthib a écrit&#160;:</cite><blockquote><div><p>@Totor : j&#039;avais pensé à un truc du genre de ta solution 1 (s/ /+/) mais malgré l&#039;excellente solution ce n&#039;est pas le plus didactique (le prof va tirer la tronche là) <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p></div></blockquote></div><p>pas forcément : tout dépend comment elle est présentée : l&#039;aspect &quot;autonomie / recherche&quot; est un point fort. De plus, il peut la donner comme solution complémentaire suivant ce qu&#039;attend le prof.<br />du style :</p><p>Solution conventionnelle avec le &quot;for&quot;..<br />En complément, voici une solution plus spécifique au language bash...</p>]]></description>
			<author><![CDATA[dummy@example.com (Totor)]]></author>
			<pubDate>Fri, 05 Feb 2010 13:07:56 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259450#p3259450</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259236#p3259236</link>
			<description><![CDATA[<p>@Totor : j&#039;avais pensé à un truc du genre de ta solution 1 (s/ /+/) mais malgré l&#039;excellente solution ce n&#039;est pas le plus didactique (le prof va tirer la tronche là) <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /><br />pour la boucle tu as tout à fait raison, c&#039;est plus simple d&#039;utiliser directement les valeurs, j&#039;ai pensé un peu trop vite <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Fri, 05 Feb 2010 10:49:42 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259236#p3259236</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259060#p3259060</link>
			<description><![CDATA[<p>question 2:</p><div class="codebox"><pre><code>#!/bin/bash
[ $# -eq 0 ] &amp;&amp; exit 1
sum=&quot;($@)/$#&quot;
bc &lt;&lt;&lt; &quot;scale=2;${sum// /+}&quot;</code></pre></div><p>Edit :<br />@nesthib : plutôt que de boucler sur les indices :</p><div class="codebox"><pre><code>sum=0
for num
do
  ((sum+=num))
done
echo &quot;Somme=${sum}&quot;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (Totor)]]></author>
			<pubDate>Fri, 05 Feb 2010 09:01:38 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3259060#p3259060</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3258584#p3258584</link>
			<description><![CDATA[<p>question 2 :</p><div class="codebox"><pre><code>function moy {
   sum=0
   for ((i=1 ; i&lt;=$# ; i++ )); do
      sum=$(( $sum + ${!i} ))
   done
   echo &quot;somme : $sum&quot;
   echo -n &quot;moyenne : &quot;
   echo &quot;scale=2 ; $sum / $#&quot; | bc
}</code></pre></div><p>je te propose (comme sputnick) que tu rédiges un post pour expliquer ce que fait le code précédent ligne à ligne.<br />après à toi de nous donner la réponse pour la question 3 (indices : <strong>while</strong> et <strong>read</strong>)</p><p>NB. le code précédent est incomplet et nécessite quelques précautions que je te laisse chercher.</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Thu, 04 Feb 2010 22:12:10 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3258584#p3258584</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3258213#p3258213</link>
			<description><![CDATA[<p>sputnick</p><p> j&#039;ai tester ton script et en le modifiant comme ceci : printf &#039;%s\n&#039; ~/Bureau/*/ | wc -l<br />j&#039;ai mis ~/Bureau/ à la place de &quot;$1&quot; pour tester le fonctionnement, et en rajoutant wc -l pour compter, cela marche à 100%, MERCI beaucoup !<br />Il semblerai que: find ~/Bureau -maxdepth 1 -type d | wc -l&#160; <br />marche également mais avec des commandes différentes.<br />Le problème 1 est résolu:D, il me reste à encore fouiner pour les 2 scripts de calcul de moyenne.</p>]]></description>
			<author><![CDATA[dummy@example.com (mega-jp)]]></author>
			<pubDate>Thu, 04 Feb 2010 19:49:40 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3258213#p3258213</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3258032#p3258032</link>
			<description><![CDATA[<p>mega-jp, peux tu me dire ce que la commande fait en Francais ?</p><div class="codebox"><pre><code>printf &#039;%s\n&#039; &quot;$1&quot;/*/</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (sputnick)]]></author>
			<pubDate>Thu, 04 Feb 2010 18:30:42 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3258032#p3258032</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257915#p3257915</link>
			<description><![CDATA[<p>sputnick, <br />ta solution printf &#039;%s\n&#039; */ | wc -l ,marche à la perfection, mais je doit donner le répertoire à &quot;analyser&quot; en paramètre du script. <br />Pourrait tu également m&#039;expliquer le fonctionnement de cette commande?<br />Merci de votre aide à tous les deux</p>]]></description>
			<author><![CDATA[dummy@example.com (mega-jp)]]></author>
			<pubDate>Thu, 04 Feb 2010 17:29:36 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257915#p3257915</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257879#p3257879</link>
			<description><![CDATA[<p>j&#039;espère répondre à ta question <img src="http://forum.ubuntu-fr.org/img/smilies/hmm.png" width="15" height="15" alt="hmm" /></p>]]></description>
			<author><![CDATA[dummy@example.com (mega-jp)]]></author>
			<pubDate>Thu, 04 Feb 2010 17:08:57 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257879#p3257879</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257868#p3257868</link>
			<description><![CDATA[<p>mon pc est un hp, ma version de ubuntu c&#039;est le Ubuntu 9.10 - le Koala Karmique</p>]]></description>
			<author><![CDATA[dummy@example.com (mega-jp)]]></author>
			<pubDate>Thu, 04 Feb 2010 17:03:26 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257868#p3257868</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257859#p3257859</link>
			<description><![CDATA[<div class="quotebox"><cite>mega-jp a écrit&#160;:</cite><blockquote><div><p>pattern not found avec /-m.{5}th</p></div></blockquote></div><p>tu ne serais pas sur du solaris toi (ou du HP mais je n&#039;y crois pas) ?<br />c&#039;est quoi comme distrib ?</p>]]></description>
			<author><![CDATA[dummy@example.com (Totor)]]></author>
			<pubDate>Thu, 04 Feb 2010 16:59:05 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257859#p3257859</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257856#p3257856</link>
			<description><![CDATA[<p>pattern not found avec /-m.{5}th</p>]]></description>
			<author><![CDATA[dummy@example.com (mega-jp)]]></author>
			<pubDate>Thu, 04 Feb 2010 16:57:45 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257856#p3257856</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257853#p3257853</link>
			<description><![CDATA[<div class="quotebox"><cite>sputnick a écrit&#160;:</cite><blockquote><div><p>On est pas loin si tu ne comprends pas. La deuxieme solution utilise les tableaux.</p></div></blockquote></div><p>moi je crains que ce soit son/sa prof qui ne comprenne pô <img src="http://forum.ubuntu-fr.org/img/smilies/lol.png" width="15" height="15" alt="lol" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Totor)]]></author>
			<pubDate>Thu, 04 Feb 2010 16:57:40 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257853#p3257853</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  comptage de dossier et calcul de moyenne]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257843#p3257843</link>
			<description><![CDATA[<p>Totor, je trouve ton, attitude un max &quot;depth&quot; ;)</p><p>Pas besoin de find en fait.</p><p>J&#039;ai confiance au fait que tu demande des réponses mais que tu souhaite les comprendre.</p><p>Donc, deux solutions :</p><p><strong>printf &#039;%s\n&#039; */ | wc -l</strong></p><p><strong>x=( */ ); echo ${#x[@]}</strong></p><p>On est pas loin si tu ne comprends pas. La deuxieme solution utilise les tableaux.</p>]]></description>
			<author><![CDATA[dummy@example.com (sputnick)]]></author>
			<pubDate>Thu, 04 Feb 2010 16:53:32 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=3257843#p3257843</guid>
		</item>
	</channel>
</rss>
