<?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=1160961&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / script if où est l'erreur]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=1160961</link>
		<description><![CDATA[Les sujets les plus récents dans script if où est l'erreur.]]></description>
		<lastBuildDate>Mon, 14 Jan 2013 19:43:01 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12209331#p12209331</link>
			<description><![CDATA[<div class="codebox"><pre class="vscroll"><code>#!/bin/sh
#script tos
export LANG=&quot;fr_BE.UTF-8&quot;

#VARIABLES EMPLACEMENTS
EMPLACEMENT=/home/$USER/Téléchargements
DESTINATION=/media/
FICHIERORIGINE=&quot;$(ls &quot;$EMPLACEMENT&quot;/*|wc -l)&quot;

#VARIABLES DIVERS
ADRESSEMAIL=&quot;mail@gmail.com&quot;
MUSIK=/home/$USER/ 
INSTANCE=$(pgrep tos | wc -l)

#VARIABLES MESSAGES
TXTMAILOK=&quot;fichiers montés&quot;
TXTOK=&quot;it&#039;s ok&quot;
TXTERREURRESEAU=&quot;erreur réseau&quot;
TXTERREURCOPIE=&quot;erreur c&quot;
if [ &quot;$FICHIERORIGINE&quot; -gt 0 ]; then

	if [ &quot;$INSTANCE&quot; -le 1 ]; then

	#SUPPRESSION DES TXT SUR BUREAU AU CAS OU RESEAU, MUSIK, COPIE NE FONCTIONNE PAS 

    	[ -e /home/$USER/Bureau/&quot;$TXTOK&quot; ] &amp;&amp; rm /home/$USER/Bureau/&quot;$TXTOK&quot;
    	[ -e /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot; ] &amp;&amp; rm /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;
    	[ -e /home/$USER/Bureau/&quot;$TXTERREURCOPIE&quot; ] &amp;&amp; rm /home/$USER/Bureau/&quot;$TXTERREURCOPIE&quot;

	#SCRIPT PROPREMENT DIT

     		fichier=$(ls &quot;$EMPLACEMENT&quot;/*.part|wc -l)
     		if [ &quot;$fichier&quot; -gt 0 ]; then
	   	echo &quot;ok&quot;
     		else
	   	mplayer &quot;$MUSIK&quot; 2&gt;/dev/null	 
	    
	   	for DOWNLOADS in &quot;$EMPLACEMENT&quot;/*;
	   	do
	   	cp &quot;$DOWNLOADS&quot; &quot;$DESTINATION&quot;
	   	rm &quot;$DOWNLOADS&quot;  
	   	done	

		#TXT
    		[ &quot;$FICHIERORIGINE&quot; -eq 0 ] &amp;&amp; touch /home/$USER/Bureau/&quot;$TXTOK&quot;
    		[ -e /home/$USER/Bureau/&quot;$TXTOK&quot; ] || touch /home/$USER/Bureau/&quot;$TXTERREURCOPIE&quot;
	  
		#VERIFICATION DU RESEAU +TXT

     		[ -e /home/$USER/Bureau/&quot;$TXTOK&quot; ] &amp;&amp; echo &quot;$TXTMAILOK&quot; | msmtp &quot;$ADRESSEMAIL&quot; || touch /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;
     		fi
	fi
fi	      
exit 0</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (greg2007)]]></author>
			<pubDate>Mon, 14 Jan 2013 19:43:01 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12209331#p12209331</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12177961#p12177961</link>
			<description><![CDATA[<div class="codebox"><pre class="vscroll"><code>#!/bin/sh
#script tos
export LANG=&quot;fr_BE.UTF-8&quot;

#VARIABLES EMPLACEMENTS
EMPLACEMENT=/home/$USER/Téléchargements
DESTINATION=/media/
FICHIERORIGINE=&quot;$(ls &quot;$EMPLACEMENT&quot;/*|wc -l)&quot;

#VARIABLES DIVERS
ADRESSEMAIL=&quot;MAIL@gmail.com&quot;
MUSIK=&quot;mamusique&quot;

#VARIABLES MESSAGES
TXTMAILOK=&quot;fichier monté&quot;
TXTOK=&quot;it&#039;s ok&quot;
TXTERREURRESEAU=&quot;erreur réseau&quot;
TXTERREURCOPIE=&quot;erreur copie&quot;


#VERIFIER SI INSTANCE EN COURS
instance=ps ax |grep &quot;tos&quot;|grep -v &quot;grep&quot;
if [ &quot;$instance&quot; -ne 1 ]; then  

#SUPPRESSION DES TXT SUR BUREAU AU CAS OU RESEAU, MUSIK, COPIE NE FONCTIONNE PAS 

    [ -e /home/$USER/Bureau/&quot;$TXTOK&quot; ] &amp;&amp; rm /home/$USER/Bureau/&quot;$TXTOK&quot;
    [ -e /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot; ] &amp;&amp; rm /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;
    [ -e /home/$USER/Bureau/&quot;$TXTERREURCOPIE&quot; ] &amp;&amp; rm /home/$USER/Bureau/&quot;$TXTERREURCOPIE&quot;

#SCRIPT PROPREMENT DIT

     fichier=$(ls &quot;$EMPLACEMENT&quot;/*.part|wc -l)
     if [ &quot;$fichier&quot; -gt 0 ]; then
	   echo &quot;ok&quot;
     else
	   mplayer /home/$USER/&quot;$MUSIK&quot;	 
	    
	   for DOWNLOADS in &quot;$EMPLACEMENT&quot;/*;
	   do
	   cp &quot;$DOWNLOADS&quot; &quot;$DESTINATION&quot; &amp;&amp; rm rm ~/Téléchargements/* 
	   ;done	

#TXT
    [ &quot;$FICHIERORIGINE&quot; -eq 0 ] &amp;&amp; touch /home/$USER/Bureau/&quot;$TXTOK&quot;
    [ -e /home/$USER/Bureau/&quot;$TXTOK&quot; ] || touch /home/$USER/Bureau/&quot;$TXTERREURCOPIE&quot;
	  
#VERIFICATION DU RESEAU +TXT

     echo &quot;$TXTMAILOK&quot; | msmtp &quot;$ADRESSEMAIL&quot; || touch /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;
     fi
      
fi 
exit 0</code></pre></div><p>Oui c&#039;est parfait<br />Pour la boucle je copie puis &amp;&amp; rm, j&#039;ai testé dans un terminal cela fonctionne. <br />Mais l&#039;idéal serait de pouvoir copier les fichiers dès que l&#039;extension&#160; part a disparue.</p>]]></description>
			<author><![CDATA[dummy@example.com (greg2007)]]></author>
			<pubDate>Sat, 12 Jan 2013 09:18:48 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12177961#p12177961</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12175111#p12175111</link>
			<description><![CDATA[<p>Ceci peut-il convenir ?</p><div class="codebox"><pre><code>echo &quot;$TXTMAILOK&quot; | msmtp &quot;$ADRESSEMAIL&quot; || touch /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;</code></pre></div><p>ou</p><div class="codebox"><pre><code>msmtp &quot;$ADRESSEMAIL&quot; &lt;&lt;&lt;&quot;$TXTMAILOK&quot; || touch /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 11 Jan 2013 21:13:10 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12175111#p12175111</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12175071#p12175071</link>
			<description><![CDATA[<p>une rustine..:( pas top mais ça marche <br />Mais encore un fichier à supprimer en début de script (fichier ok)</p><div class="codebox"><pre><code>echo &quot;$TXTMAILOK&quot; | msmtp &quot;$ADRESSEMAIL&quot; &amp;&amp; touch &quot;$EMPLACEMENT&quot;/ok
[ ! -e &quot;&quot;$EMPLACEMENT&quot;/ok&quot; ] &amp;&amp; touch /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (greg2007)]]></author>
			<pubDate>Fri, 11 Jan 2013 21:07:38 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12175071#p12175071</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12173731#p12173731</link>
			<description><![CDATA[<p>Merci, encore une chose en plus d&#039;apprise <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>Par contre je me rends compte que je me plante royalement en faisant mon test de réseau qui dit : si la commande d&#039;envoi de mail est strictement égal à 1alors tu produits un fichier erreur réseau sinon tu envoies le mail</p><p>En fait il est impossible de savoir si la commande renvoie 1 ou 0 puisque la commande doit être lancée préalablement &gt;&gt;&gt; ma syntaxe n&#039;est pas bonne et j&#039;ai des erreurs . Comment fait-on dans ce cas si on ne sait pas mettre de condition&#160; ? </p><div class="codebox"><pre><code>#VERIFICATION DU RESEAU

		if  [ echo $TXTMAILOK | msmtp $ADRESSEMAIL -eq 1 ]; then
		touch /home/$USER/Bureau/$TXTERREURRESEAU
		else 
		echo $TXTMAILOK | msmtp $ADRESSEMAIL
		fi</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (greg2007)]]></author>
			<pubDate>Fri, 11 Jan 2013 19:09:10 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12173731#p12173731</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12173541#p12173541</link>
			<description><![CDATA[<p>Réponses à quelques unes de tes questions :</p><p>1) Il est possible de mettre un <strong>echo</strong> devant les commandes</p><p>2)</p><div class="codebox"><pre><code>if [ -e &quot;$TXTOK&quot; ]; then
rm /home/$USER/Bureau/&quot;$TXTOK&quot;
fi </code></pre></div><p>ou</p><div class="codebox"><pre><code>[ -e &quot;$TXTOK&quot; ] &amp;&amp; rm /home/$USER/Bureau/&quot;$TXTOK&quot;</code></pre></div><p>3) </p><div class="quotebox"><blockquote><div><p>esac correspond en gros au fi de la fonction if ?</p></div></blockquote></div><p>Oui</p><p>5) L&#039;option <strong>-b</strong> de <strong>mv</strong> fait un backup du fichier de <strong>destination</strong>, s&#039;il existe déjà</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 11 Jan 2013 18:52:29 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12173541#p12173541</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12173071#p12173071</link>
			<description><![CDATA[<p>Ok , c&#039;est noté pingouinux, je change toutes mes variables suivant tes conseils. </p><p>1.je me demandais justement s&#039;il n&#039;y avait pas une possibilité de tester un code virtuellement sans effectuer les actions ? </p><p>2.Je ne te demande pas de vérifier tout mon script mais est-ce que cette action <br />si le fichier txtok est présent alors tu le supprimes sinon tu ne fais rien et tu continues le script est correcte ? </p><div class="codebox"><pre><code>if [ $TXTOK -e ]; then
rm /home/$USER/Bureau/&quot;$TXTOK&quot;
fi </code></pre></div><br /><p>3.pour case </p><div class="codebox"><pre><code>case variable in
    modèle [ | modèle] ...) instructions;;
    modèle [ | modèle] ...) instructions;;
      ...
esac</code></pre></div><p>esac correspond en gros au <strong>fi </strong>de la fonction <strong>if</strong> ? </p><p>Par contre, je souhaiterai encore améliorer mon script. <br />4. déjà en faisant cp /* c&#039;est un peu lourd, non ?<br />ne vaudrait-il pas mieux faire un boucle</p><div class="codebox"><pre><code>for part in $fichier; do
    cp &quot;$fichier&quot; &quot;$emplacement&quot; 
done</code></pre></div><p>5. je souhaiterai modifier mon <strong>cp</strong> par un <strong>mv</strong>, mais il faudrait qu&#039;en cas de pépin ou par exemple si je décide volontairement de mettre fin au script que le fichier ne soit pas perdu. J&#039;ai vu l&#039;option </p><div class="codebox"><pre><code>mv -b</code></pre></div><p>pour faire un backup mais cela n&#039;a pas l&#039;air de fonctionner chez moi...</p><p>6.enfin je souhaiterai déplacer mes fichiers à la volée, je m&#039;explique si mon <strong>ls</strong><br />donne</p><div class="codebox"><pre><code>fichier1.part
fichier1
fichier2.part
fichier2</code></pre></div><p>et que si le fichier 1 est prêt, je puisse déjà le déplacer sans attendre que tous les *.part soient partis&#160; </p><div class="codebox"><pre><code>fichier1
fichier2.part
fichier2</code></pre></div><p>je crois que c&#039;est possible via un tableau mais je coince au niveau de la syntaxe, si vous pouviez me donner une piste, ce serait sympa. </p><div class="codebox"><pre><code> tab=(&quot;John Smith&quot; &quot;Jane Doe&quot;)</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (greg2007)]]></author>
			<pubDate>Fri, 11 Jan 2013 18:14:20 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12173071#p12173071</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12170711#p12170711</link>
			<description><![CDATA[<p>Bonjour,<br />@greg2007 #15 :<br />À l&#039;utilisation, mettre les variables entre <strong>&quot; &quot;</strong> pour que les espaces éventuels soient traités correctement.<br />Par exemple :</p><div class="codebox"><pre><code>cp ~/Téléchargements/* &quot;$DESTINATION&quot; &amp;&amp; touch &quot;/home/$USER/Bureau/$TXTOK&quot;</code></pre></div><p><span class="bbu">Ajouté</span> : Il y a plusieurs commandes qui ne fonctionneront pas dans ton script. Tu as intérêt à l&#039;écrire petit à petit et à faire des exécutions partielles pour corriger les erreurs.</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 11 Jan 2013 15:52:13 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12170711#p12170711</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12169591#p12169591</link>
			<description><![CDATA[<p>oui c&#039;est vrai que c&#039;est plus dur à s&#039;y retrouver du coup <img src="http://forum.ubuntu-fr.org/img/smilies/neutral.png" width="15" height="15" alt="neutral" /></p>]]></description>
			<author><![CDATA[dummy@example.com (greg2007)]]></author>
			<pubDate>Fri, 11 Jan 2013 14:11:19 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12169591#p12169591</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12169551#p12169551</link>
			<description><![CDATA[<p>Je suis plus un adepte du case que des if à la suite. mais ça me parait pas mal déjà <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (shoot76)]]></author>
			<pubDate>Fri, 11 Jan 2013 14:07:46 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12169551#p12169551</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12169521#p12169521</link>
			<description><![CDATA[<p>Encore merci pour vos contributions.</p><p>Voici donc la bestiole <img src="http://forum.ubuntu-fr.org/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p><p>J&#039;ai essayé d&#039;imaginer tous les cas de figures <br />&gt;stopper l&#039;instance du script si elle est en cours <br />&gt; renvoyer une erreur sous forme de fichier sur le bureau si le réseau est HS (je suis un afficionado du bureau vide, donc je le verrai)<br />&gt; jouer une musique lorsque la copie est terminée et placer ma commande en <br />commande 1<br />commande 2 <br />afin que si ma commande musique renvoie une erreur alors le reste du script s&#039;exécute qd même<br />&gt;supprimer tous mes petits fichier sur le bureau dès qu&#039;une nouvelle instance sera lancée.</p><p>Merci de me faire part de vos commentaires ou suggestions et bonne journée. </p><div class="codebox"><pre class="vscroll"><code>#!/bin/sh
#şcript DOCI
export LANG=&quot;fr_BE.UTF-8&quot;

#VARIABLES

TXTMAILOK=&quot;fichier monté&quot;
EMPLACEMENT=&quot;/home/$USER/Téléchargements&quot;
MUSIK=&quot;mamusiqued&#039;avertissement&quot;
DESTINATION=&quot;/media/madestination/&quot;
TXTOK=&quot;it&#039;s ok&quot;
ADRESSEMAIL=&quot;monmail@gmail.com&quot;
TXTERREURRESEAU=&quot;erreur réseau&quot;

#VERIFIER SI INSTANCE
instance=ps ax |grep &quot;tos&quot;|grep -v &quot;grep&quot;
if [ $instance -ne 1 ]; then  

#SUPPRESSION DES TXT SUR BUREAU AU CAS OU RESEAU NE FONCTIONNE PAS ET MUSIK NE FONCTIONNE PAS
if [ &quot;$TXTOK&quot; -e ]; then
rm /home/$USER/Bureau/&quot;$TXTOK&quot;
fi 

if [ &quot;$TXTERREURRESEAU&quot; -e ]; then
rm /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;
fi 

#SCRIPT PROPREMENT DIT

      fichier=$(ls &quot;$EMPLACEMENT&quot;/*.part|wc -l)
      if [ &quot;$fichier&quot; -gt 0 ]; then
	   echo &quot;ok&quot;
      else
	  mplayer /home/$USER/&quot;$MUSIK&quot;	  
	  cp ~/Téléchargements/* &quot;$DESTINATION&quot; &amp;&amp; touch /home/$USER/Bureau/&quot;$TXTOK&quot;
	  
#VERIFICATION DU RESEAU

		if  [ echo &quot;$TXTMAILOK&quot; | msmtp &quot;$ADRESSEMAIL&quot; -eq 1 ]; then
		touch /home/$USER/Bureau/&quot;$TXTERREURRESEAU&quot;
		else 
		echo &quot;$TXTMAILOK&quot; | msmtp &quot;$ADRESSEMAIL&quot;
		fi
      fi
      
fi 
exit 0</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (greg2007)]]></author>
			<pubDate>Fri, 11 Jan 2013 14:04:14 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12169521#p12169521</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12139311#p12139311</link>
			<description><![CDATA[<p>ouais il faut donc que le script indique qu&#039;il utilise bash <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Hizoka)]]></author>
			<pubDate>Wed, 09 Jan 2013 00:44:43 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12139311#p12139311</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12138001#p12138001</link>
			<description><![CDATA[<p>@Hizoka :<br />C&#039;est curieux, voici ce que j&#039;obtiens.</p><div class="codebox"><pre><code>$ cat mon_script
sleep 20
$ ./mon_script</code></pre></div><p>Dans une autre fenêtre</p><div class="codebox"><pre><code>$ ps ax | grep &quot;mon_script&quot; | grep -v &quot;grep&quot;</code></pre></div><p>et avec</p><div class="codebox"><pre><code>$ bash ./mon_script</code></pre></div><div class="codebox"><pre><code>$ ps ax | grep &quot;mon_script&quot; | grep -v &quot;grep&quot;
 8096 pts/4    S+     0:00 bash ./mon_script</code></pre></div><p><span class="bbu">Mon environnement</span> :<br />Ubuntu 12.04.1 LTS<br />GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)</p><p><span class="bbu">Ajouté</span> :<br />Comme ceci, ça marche :</p><div class="codebox"><pre><code>$ cat mon_script
#!/bin/bash
sleep 20
$./mon_script</code></pre></div><div class="codebox"><pre><code>$ ps ax | grep &quot;mon_script&quot; | grep -v &quot;grep&quot;
 8157 pts/4    S+     0:00 /bin/bash ./mon_script</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Tue, 08 Jan 2013 22:01:39 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12138001#p12138001</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12137791#p12137791</link>
			<description><![CDATA[<div class="codebox"><pre><code>cat cacaca
#!/bin/bash
read -p &quot;cacaca&quot;</code></pre></div><p>si je lance via ./cacaca</p><div class="codebox"><pre><code>ps ax | grep &quot;cacaca&quot; | grep -v &quot;grep&quot;
22956 pts/3    S+     0:00 /bin/bash ./cacaca</code></pre></div><p>si je lance via bash cacaca</p><div class="codebox"><pre><code>ps ax | grep &quot;cacaca&quot; | grep -v &quot;grep&quot;
23020 pts/3    S+     0:00 bash cacaca</code></pre></div><p>au final c&#039;est toujours trouvable non ?</p><p>Sinon on peut toujours utiliser pstree à la place de ps non ?</p><p>Mais via un fichier temporaire, c&#039;est en effet ce qu&#039;il y a de plus simple.</p>]]></description>
			<author><![CDATA[dummy@example.com (Hizoka)]]></author>
			<pubDate>Tue, 08 Jan 2013 21:42:53 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12137791#p12137791</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  script if où est l'erreur]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12136811#p12136811</link>
			<description><![CDATA[<p>@Hizoka #10 :<br />Le problème, c&#039;est que lorsqu&#039;on lance un script, le nom de la commande est <strong>bash</strong>, et pas le nom du script (d&#039;après les tests que je viens de faire).</p><p><span class="bbu">Rectificatif</span> : Ce que tu proposes marche si on lance le script ainsi : <strong>bash -c nom_du_script</strong></p><p>On peut aussi envisager quelque chose comme ça, mais on peut sans doute simplifier.</p><div class="codebox"><pre><code># En tête du script

rm_verrou() { rm /tmp/verrou_$$; trap &#039;&#039; EXIT; exit; }
trap rm_verrou TERM EXIT
for verrou in /tmp/verrou_*
do
   [ -f &quot;$verrou&quot; ] &amp;&amp; { kill INT ${verrou#*_} 2&gt;/dev/null || rm $verrou; }
done
touch /tmp/verrou_$$

# Le script est ici
.........................</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Tue, 08 Jan 2013 20:53:48 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12136811#p12136811</guid>
		</item>
	</channel>
</rss>
