<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Posteet: benoitbalon: bash</title> 
    <link>http://www.posteet.com/</link> 
    <description>Recent posteets posted to Posteet</description>
    <ttl>60</ttl>

    
    <item>
        <title>Supprimer ces foutus fichiers Thumbs.db</title>
        <link>http://www.posteet.com/view/1218</link>
        <description>
        <![CDATA[<pre>rm `find . -name &quot;*.db&quot; -print`</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/find">[find]</a>  <a href="http://www.posteet.com/tags/rm">[rm]</a>  <a href="http://www.posteet.com/tags/thumbnails">[thumbnails]</a>  <a href="http://www.posteet.com/tags/thumbs.db">[thumbs.db]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Fri, 22 Aug 2008 16:33:19 +0000</pubDate>

            <category>bash</category>
            <category>find</category>
            <category>rm</category>
            <category>thumbnails</category>
            <category>thumbs.db</category>
    
    </item>

  
    <item>
        <title>Modifier la date de la prise d'une photo dans les informations EXIF</title>
        <link>http://www.posteet.com/view/1217</link>
        <description>
        <![CDATA[<pre>#! /bin/bash

for i in `ls -1 *.jpg`
do
    # Affiche la date et l'heure auxquelles la photo a ete prise (encore faut-il que l'appareil photo soit correctement configure !)
    exiv2 $i | grep Horodatage

    # Change l'annee de la prise de la photo (ici l'annee 2008)
    jhead -ds2008 $i

    # Avance l'heure de la prise de la photo (ici 1h 30m et 5s)
    jhead -ta+01:30:05 $i

    # Recule l'heure de la prise de la photo (ici 0h 20m et 0s)
    jhead -ta-00:20:00 $i
done</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/date">[date]</a>  <a href="http://www.posteet.com/tags/exif">[exif]</a>  <a href="http://www.posteet.com/tags/exiv2">[exiv2]</a>  <a href="http://www.posteet.com/tags/jhead">[jhead]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Fri, 22 Aug 2008 16:27:43 +0000</pubDate>

            <category>bash</category>
            <category>date</category>
            <category>exif</category>
            <category>exiv2</category>
            <category>jhead</category>
    
    </item>

  
    <item>
        <title>Barre de progression à largeur automatique</title>
        <link>http://www.posteet.com/view/938</link>
        <description>
        <![CDATA[<pre>#!/bin/sh

# ex :
# ~$ test.sh 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# [||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||] 100.00%

barre_progression ()
{
	nb_iterations=$1
	liste_length=$2
	pourcent=`echo &quot;scale=2;($nb_iterations * 100) / $liste_length&quot; | bc`
	pourcent=`printf &quot;% 3.2f&quot; &quot;$pourcent&quot;`
	
	chaine=&quot;$pourcent&quot;
	nb_etoiles=`echo &quot;scale=0;$chaine / $diviseur_barre&quot; | bc`
	etoiles=&quot;&quot;
	while test $nb_etoiles -gt 0
	do
		etoiles=&quot;${caractere_barre}${etoiles}&quot;
		nb_etoiles=`echo &quot;$nb_etoiles - 1&quot; | bc`
	done
	etoiles=`printf &quot;[%-${largeur_barre}s]&quot; &quot;$etoiles&quot;`
	pourcentage=`printf &quot;%7s&quot; &quot;$chaine&quot;`
	#echo &quot;\r${etoiles}${pourcentage}%\r\c&quot;
	printf &quot;%b%b%b&quot; &quot;\r${etoiles}&quot; &quot;${pourcentage}&quot; &quot;%\r\c&quot;
}

# INITIALISATION DE LA BARRE DE PROGRESSION
init_progress_bar ()
{
	# caractere qui sera affiche dans la barre de progression
	caractere_barre=&quot;|&quot;
	
	# detection de l'OS
	os=`uname -s | tr [a-z] [A-Z]`
	
	# recuperation de la largeur en caracteres du terminal
	if test &quot;$os&quot; = &quot;LINUX&quot;
	then
		largeur_ecran=`stty -a | grep columns | cut -d ' ' -f7 | tr -d ';'`
	elif test &quot;$os&quot; = &quot;SUNOS&quot;
	then
		largeur_ecran=`stty | grep columns | cut -d ' ' -f6 | tr -d ';'`
	else
		echo &quot;Systeme d'exploitation incompatible, programme stoppe&quot;
		exit 1
	fi
	
	# calcul de la largeur optimale de la barre de progression 
	largeur_barre=`echo &quot;$largeur_ecran - 7 - 2 - 1&quot; | bc`
	diviseur_barre=`echo &quot;scale=2;100 / $largeur_barre&quot; | bc`
	
	# protection des variables
	readonly largeur_ecran largeur_barre diviseur_barre caractere_barre
}

# gestion de la langue de l'environnement
LC_NUMERIC=C

init_progress_bar

liste_length=$#
nb_iterations=0
if test $liste_length -gt 0
then
	for i in $@ 
	do
		nb_iterations=`echo &quot;$nb_iterations + 1&quot; | bc`
		barre_progression &quot;$nb_iterations&quot; &quot;$liste_length&quot;
		# sleep 1
	done
fi

echo &quot; &quot;</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/bc">[bc]</a>  <a href="http://www.posteet.com/tags/printf">[printf]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/stty">[stty]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Wed, 07 May 2008 12:44:58 +0000</pubDate>

            <category>bash</category>
            <category>bc</category>
            <category>printf</category>
            <category>shell</category>
            <category>stty</category>
    
    </item>

  
    <item>
        <title>Renommer des fichiers pour retirer les caractères spéciaux</title>
        <link>http://www.posteet.com/view/855</link>
        <description>
        <![CDATA[<pre>for i in `ls -1`; do cd $i; rename 's/ +/_/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename &quot;s/'/-/g&quot; *; cd ..; done
for i in `ls -1`; do cd $i; rename &quot;s/[?!%]//g&quot; *; cd ..; done
for i in `ls -1`; do cd $i; rename &quot;s/[?]//g&quot; *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[!%?]//g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[àâ]/a/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[éèêë]/e/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[oöô]/o/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[ûù]/u/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[ä]/a/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[ü]/u/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[,]/-/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/[(){}]/-/g' *; cd ..; done
for i in `ls -1`; do cd $i; rename 's/traeve/treve/g' *; cd ..; done</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/rename">[rename]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Tue, 01 Apr 2008 18:05:27 +0000</pubDate>

            <category>bash</category>
            <category>rename</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Quantième jour</title>
        <link>http://www.posteet.com/view/797</link>
        <description>
        <![CDATA[<pre>#!/bin/sh

usage=&quot;Usage : $0 -q `date +'%j'` [-y `date +'%Y'`]&quot;

# gestion de la ligne de commande
if test &quot;$#&quot; -eq 2
then
	if test &quot;$1&quot; != &quot;-q&quot;
	then
		echo $usage
		exit 1
	fi
elif test &quot;$#&quot; -eq 4
then
	if test &quot;$1&quot; != &quot;-q&quot;
	then
		echo $usage
		exit 1
	fi
	if test &quot;$3&quot; != &quot;-y&quot;
	then
		echo $usage
		exit 1
	fi
else
	echo $usage
	exit 1
fi

qte=$2

if test &quot;$4&quot; != &quot;&quot;
then
	annee_act=$4
	val_y=`expr $annee_act + 1 2&gt;&gt; /dev/null`
	if test &quot;$?&quot; != &quot;0&quot;
	then
		echo $usage
		exit 1
	fi
fi

# verification des nombres
val_q=`expr $qte + 1 2&gt;&gt; /dev/null`
if test &quot;$?&quot; != &quot;0&quot;
then
	echo $usage
	exit 1
fi

# depassements de valeurs
if test &quot;$qte&quot; -gt 366
then
	echo $usage
	exit 1
fi

if test &quot;$qte&quot; -lt 1
then
	echo $usage
	exit 1
fi

# comparaison avec le quantieme actuel
if test &quot;$4&quot; = &quot;&quot;
then
	qte_act=`date +'%j'`
	annee_act=`date +'%Y'`

	if test &quot;$qte_act&quot; -gt &quot;$qte&quot;
	then
		continue
	elif test &quot;$qte_act&quot; -lt &quot;$qte&quot;
	then
		# la date recherchee est dans l'annee passee
		annee_act=`expr $annee_act - 1`
	else
		# la date recherchee est celle d'aujourd'hui
		echo `date +'%Y-%m-%d'`
		exit 0
	fi
fi


bis=`expr $annee_act % 4`
if test &quot;$bis&quot; -gt 0
then
	fin_janvier=31
	fin_fevrier=`expr 31 + 28`
	fin_mars=`expr 31 + 28 + 31`
	fin_avril=`expr 31 + 28 + 31 + 30`
	fin_mai=`expr 31 + 28 + 31 + 30 + 31`
	fin_juin=`expr 31 + 28 + 31 + 30 + 31 + 30`
	fin_juillet=`expr 31 + 28 + 31 + 30 + 31 + 30 + 31`
	fin_aout=`expr 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31`
	fin_septembre=`expr 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30`
	fin_octobre=`expr 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31`
	fin_novembre=`expr 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30`
	#fin_decembre=`expr 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31`
else
	fin_janvier=31
	fin_fevrier=`expr 31 + 29`
	fin_mars=`expr 31 + 29 + 31`
	fin_avril=`expr 31 + 29 + 31 + 30`
	fin_mai=`expr 31 + 29 + 31 + 30 + 31`
	fin_juin=`expr 31 + 29 + 31 + 30 + 31 + 30`
	fin_juillet=`expr 31 + 29 + 31 + 30 + 31 + 30 + 31`
	fin_aout=`expr 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31`
	fin_septembre=`expr 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30`
	fin_octobre=`expr 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31`
	fin_novembre=`expr 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30`
	#fin_decembre=`expr 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31`
fi

# annee non bissextile
if test &quot;$qte&quot; -eq 366 &amp;&amp; test &quot;$bis&quot; -gt 0
then
	exit 1
fi

# detection de l'annee bissextile
if test &quot;$qte&quot; -le &quot;$fin_janvier&quot;
then
	mois=&quot;01&quot;
	jour=`expr $qte + 0`
elif test &quot;$qte&quot; -le &quot;$fin_fevrier&quot;
then
	mois=&quot;02&quot;
	jour=`expr $qte - 31`
elif test &quot;$qte&quot; -le &quot;$fin_mars&quot;
then
	mois=&quot;03&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_avril&quot;
then
	mois=&quot;04&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_mai&quot;
then
	mois=&quot;05&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_juin&quot;
then
	mois=&quot;06&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30 - 31`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30 - 31`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_juillet&quot;
then
	mois=&quot;07&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30 - 31 - 30`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30 - 31 - 30`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_aout&quot;
then
	mois=&quot;08&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30 - 31 - 30 - 31`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30 - 31 - 30 - 31`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_septembre&quot;
then
	mois=&quot;09&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30 - 31 - 30 - 31 - 31`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30 - 31 - 30 - 31 - 31`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_octobre&quot;
then
	mois=&quot;10&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30 - 31 - 30 - 31 - 31 - 30`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30 - 31 - 30 - 31 - 31 - 30`&quot;
	fi
elif test &quot;$qte&quot; -le &quot;$fin_novembre&quot;
then
	mois=&quot;11&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31`&quot;
	fi
else
	mois=&quot;12&quot;
	if test &quot;$bis&quot; -gt 0
	then
		jour=&quot;`expr $qte - 31 - 28 - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - 30`&quot;
	else
		jour=&quot;`expr $qte - 31 - 29 - 31 - 30 - 31 - 30 - 31 - 31 - 30 - 31 - 30`&quot;
	fi
fi

# affichage de la date trouvee
if test &quot;$jour&quot; -lt 10
then
	echo &quot;${annee_act}-${mois}-0${jour}&quot;
else
	echo &quot;${annee_act}-${mois}-${jour}&quot;
fi</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/date">[date]</a>  <a href="http://www.posteet.com/tags/jour">[jour]</a>  <a href="http://www.posteet.com/tags/numero jour">[numero jour]</a>  <a href="http://www.posteet.com/tags/quantieme">[quantieme]</a>  <a href="http://www.posteet.com/tags/quantieme jour">[quantieme jour]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Thu, 28 Feb 2008 12:43:59 +0000</pubDate>

            <category>bash</category>
            <category>date</category>
            <category>jour</category>
            <category>numero jour</category>
            <category>quantieme</category>
            <category>quantieme jour</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Génération de données calendaires au format XML</title>
        <link>http://www.posteet.com/view/680</link>
        <description>
        <![CDATA[<pre>#!/bin/sh

annee=&quot;$1&quot;
true=1
false=0

# permet de lancer la commande cal pour un mois et une annee precis, et de traiter le decoupage des semaines
get_month ()
{
	annee=&quot;$1&quot;
	mois=&quot;$2&quot;
	numligne=&quot;0&quot;
	
	# execution de cal, et lecture de la sortie ligne par ligne
	cal -m $mois $annee | while read ligne 
	do
		numligne=$((numligne + 1))
		
		# on ne tient pas compte des lignes vides retournees par cal
		if test &quot;`echo $ligne | tr -d ' '`&quot; != &quot;&quot; 
		then
			
			# on ne tient pas compte de la premiere ligne (mois et annee en cours) et de la deuxieme ligne (noms des jours)
			if test &quot;$numligne&quot; -gt 2
			then
				
				# on tient compte de la premiere semaine du mois, afin de connaitre la position du premier jour
				if test &quot;$numligne&quot; -lt 4
				then
					set_days $true $ligne
				else
					set_days $false $ligne
				fi
				
			fi
			
		fi
		
	done
}

# permet de decouper une semaine (une ligne retournee par cal) en jours
set_days ()
{
	nb_jours=`expr $# - 1`
	is_first_line=$1
	
	# on identifie le nombre de jours du mois en cours compris dans la semaine que l'on traite
	case $nb_jours in
		1) # cette semaine ne comprend qu'un jour du mois en cours, le premier ou le dernier jour du mois
			if test &quot;$is_first_line&quot; = &quot;$true&quot;
			then
				set_day 7 $2
			else
				set_day 1 $2
			fi
			;;
		2) # cette semaine comprend deux jours du mois en cours, les deux premiers ou les deux derniers
			if test &quot;$is_first_line&quot; = &quot;$true&quot;
			then
				set_day 6 $2
				set_day 7 $3
			else
				set_day 1 $2
				set_day 2 $3
			fi
			;;
		3) # cette semaine comprend trois jours du mois en cours, les trois premiers ou les trois derniers
			if test &quot;$is_first_line&quot; = &quot;$true&quot;
			then
				set_day 5 $2
				set_day 6 $3
				set_day 7 $4
			else
				set_day 1 $2
				set_day 2 $3
				set_day 3 $4
			fi
			;;
		4) # cette semaine comprend quatre jours du mois en cours, les quatre premiers ou les quatre derniers
			if test &quot;$is_first_line&quot; = &quot;$true&quot;
			then
				set_day 4 $2
				set_day 5 $3
				set_day 6 $4
				set_day 7 $5
			else
				set_day 1 $2
				set_day 2 $3
				set_day 3 $4
				set_day 4 $5
			fi
			;;
		5) # cette semaine comprend cinq jours du mois en cours, les cinq premiers ou les cinq derniers
			if test &quot;$is_first_line&quot; = &quot;$true&quot;
			then
				set_day 3 $2
				set_day 4 $3
				set_day 5 $4
				set_day 6 $5
				set_day 7 $6
			else
				set_day 1 $2
				set_day 2 $3
				set_day 3 $4
				set_day 4 $5
				set_day 5 $6
			fi
			;;
		6) # cette semaine comprend six jours du mois en cours, les six premiers ou les six derniers
			if test &quot;$is_first_line&quot; = &quot;$true&quot;
			then
				set_day 2 $2
				set_day 3 $3
				set_day 4 $4
				set_day 5 $5
				set_day 6 $6
				set_day 7 $7
			else
				set_day 1 $2
				set_day 2 $3
				set_day 3 $4
				set_day 4 $5
				set_day 5 $6
				set_day 6 $7
			fi
			;;
		7) # cette semaine est pleine, donc on sait que le premier numero correspondra au lundi
			set_day 1 $2
			set_day 2 $3
			set_day 3 $4
			set_day 4 $5
			set_day 5 $6
			set_day 6 $7
			set_day 7 $8
			;;
		*)
			echo &quot;Un probleme a du survenir...&quot;
			exit 1
			;;
	esac
}

# permet de recopier en sortie la correspondance entre le jour et son numero dans le mois
set_day ()
{
	echo &quot;          &lt;jour nom=\&quot;$1\&quot; numero=\&quot;$2\&quot;/&gt;&quot;
}

# lance le traitement pour le calendrier d'une annee, mois par mois
make_calendrier ()
{
	echo &quot;&lt;annee numero=\&quot;$annee\&quot;&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;1\&quot;&gt;&quot;
	get_month $annee 1
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;2\&quot;&gt;&quot;
	get_month $annee 2
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;3\&quot;&gt;&quot;
	get_month $annee 3
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;4\&quot;&gt;&quot;
	get_month $annee 4
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;5\&quot;&gt;&quot;
	get_month $annee 5
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;6\&quot;&gt;&quot;
	get_month $annee 6
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;7\&quot;&gt;&quot;
	get_month $annee 7
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;8\&quot;&gt;&quot;
	get_month $annee 8
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;9\&quot;&gt;&quot;
	get_month $annee 9
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;10\&quot;&gt;&quot;
	get_month $annee 10
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;11\&quot;&gt;&quot;
	get_month $annee 11
	echo &quot;     &lt;/mois&gt;&quot;
	
	echo &quot;     &lt;mois numero=\&quot;12\&quot;&gt;&quot;
	get_month $annee 12
	echo &quot;     &lt;/mois&gt;&quot;

	echo &quot;&lt;/annee&gt;&quot;
}

echo &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;ISO-8859-1\&quot;?&gt;&quot;
echo &quot;&lt;!--?xml-stylesheet href=\&quot;calendrier.xsl\&quot; type=\&quot;text/xsl\&quot;?--&gt;&quot;
echo &quot;&lt;calendrier&gt;&quot;
echo &quot;&lt;noms_jours&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;fr\&quot;&gt;lundi&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;fr\&quot;&gt;mardi&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;fr\&quot;&gt;mercredi&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;fr\&quot;&gt;jeudi&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;fr\&quot;&gt;vendredi&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;fr\&quot;&gt;samedi&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;fr\&quot;&gt;dimanche&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;it\&quot;&gt;luned&amp;#236;&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;it\&quot;&gt;marted&amp;#236;&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;it\&quot;&gt;mercoled&amp;#236;&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;it\&quot;&gt;gioved&amp;#236;&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;it\&quot;&gt;venerd&amp;#236;&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;it\&quot;&gt;sabato&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;it\&quot;&gt;domenica&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;en\&quot;&gt;monday&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;en\&quot;&gt;tuesday&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;en\&quot;&gt;wednesday&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;en\&quot;&gt;thursday&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;en\&quot;&gt;friday&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;en\&quot;&gt;saturday&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;en\&quot;&gt;sunday&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;de\&quot;&gt;montag&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;de\&quot;&gt;dienstag&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;de\&quot;&gt;mittwoch&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;de\&quot;&gt;donnerstag&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;de\&quot;&gt;freitag&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;de\&quot;&gt;samstag&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;de\&quot;&gt;sonntag&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;es\&quot;&gt;lunes&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;es\&quot;&gt;martes&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;es\&quot;&gt;mi&amp;#233;rcoles&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;es\&quot;&gt;jueves&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;es\&quot;&gt;viernes&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;es\&quot;&gt;s&amp;#225;bado&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;es\&quot;&gt;domingo&lt;/nom&gt;&quot;
echo &quot;&lt;/noms_jours&gt;&quot;
echo &quot;&lt;noms_mois&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;fr\&quot;&gt;janvier&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;fr\&quot;&gt;f&amp;#233;vrier&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;fr\&quot;&gt;mars&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;fr\&quot;&gt;avril&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;fr\&quot;&gt;mai&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;fr\&quot;&gt;juin&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;fr\&quot;&gt;juillet&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;8\&quot; lang=\&quot;fr\&quot;&gt;ao&amp;#251;t&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;9\&quot; lang=\&quot;fr\&quot;&gt;septembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;10\&quot; lang=\&quot;fr\&quot;&gt;octobre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;11\&quot; lang=\&quot;fr\&quot;&gt;novembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;12\&quot; lang=\&quot;fr\&quot;&gt;d&amp;#233;cembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;en\&quot;&gt;january&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;en\&quot;&gt;february&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;en\&quot;&gt;march&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;en\&quot;&gt;april&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;en\&quot;&gt;may&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;en\&quot;&gt;june&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;en\&quot;&gt;july&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;8\&quot; lang=\&quot;en\&quot;&gt;august&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;9\&quot; lang=\&quot;en\&quot;&gt;september&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;10\&quot; lang=\&quot;en\&quot;&gt;october&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;11\&quot; lang=\&quot;en\&quot;&gt;november&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;12\&quot; lang=\&quot;en\&quot;&gt;december&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;es\&quot;&gt;enero&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;es\&quot;&gt;febrero&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;es\&quot;&gt;marzo&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;es\&quot;&gt;abril&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;es\&quot;&gt;mayo&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;es\&quot;&gt;junio&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;es\&quot;&gt;julio&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;8\&quot; lang=\&quot;es\&quot;&gt;agosto&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;9\&quot; lang=\&quot;es\&quot;&gt;septiembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;10\&quot; lang=\&quot;es\&quot;&gt;octubre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;11\&quot; lang=\&quot;es\&quot;&gt;noviembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;12\&quot; lang=\&quot;es\&quot;&gt;diciembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;de\&quot;&gt;januar&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;de\&quot;&gt;februar&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;de\&quot;&gt;m&amp;#228;rz&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;de\&quot;&gt;april&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;de\&quot;&gt;mai&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;de\&quot;&gt;juni&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;de\&quot;&gt;juli&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;8\&quot; lang=\&quot;de\&quot;&gt;august&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;9\&quot; lang=\&quot;de\&quot;&gt;september&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;10\&quot; lang=\&quot;de\&quot;&gt;oktober&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;11\&quot; lang=\&quot;de\&quot;&gt;november&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;12\&quot; lang=\&quot;de\&quot;&gt;dezember&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;1\&quot; lang=\&quot;it\&quot;&gt;gennaio&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;2\&quot; lang=\&quot;it\&quot;&gt;febbraio&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;3\&quot; lang=\&quot;it\&quot;&gt;marzo&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;4\&quot; lang=\&quot;it\&quot;&gt;aprile&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;5\&quot; lang=\&quot;it\&quot;&gt;maggio&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;6\&quot; lang=\&quot;it\&quot;&gt;giugno&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;7\&quot; lang=\&quot;it\&quot;&gt;luglio&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;8\&quot; lang=\&quot;it\&quot;&gt;agosto&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;9\&quot; lang=\&quot;it\&quot;&gt;settembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;10\&quot; lang=\&quot;it\&quot;&gt;ottobre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;11\&quot; lang=\&quot;it\&quot;&gt;novembre&lt;/nom&gt;&quot;
echo &quot;	&lt;nom numero=\&quot;12\&quot; lang=\&quot;it\&quot;&gt;dicembre&lt;/nom&gt;&quot;
echo &quot;&lt;/noms_mois&gt;&quot;

# lance le traitement du calendrier de chaque annee passee en parametre du script
for annee in $@
do
	make_calendrier $annee
done

echo &quot;&lt;/calendrier&gt;&quot;

exit 0</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/cal">[cal]</a>  <a href="http://www.posteet.com/tags/calendrier">[calendrier]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/xml">[xml]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Thu, 17 Jan 2008 12:50:03 +0000</pubDate>

            <category>bash</category>
            <category>cal</category>
            <category>calendrier</category>
            <category>shell</category>
            <category>xml</category>
    
    </item>

  
    <item>
        <title>Centrage ou alignement d'un texte</title>
        <link>http://www.posteet.com/view/659</link>
        <description>
        <![CDATA[<pre>affiche_texte ()
{
	texte=&quot;$1&quot;
	alignement=&quot;$2&quot;
	nbcolonnes=80
	
	if test &quot;$alignement&quot; = &quot;R&quot;
	then
		printf &quot;%${nbcolonnes}s\n&quot; &quot;$texte&quot;
	elif test &quot;$alignement&quot; = &quot;L&quot;
	then
		printf &quot;%-${nbcolonnes}s\n&quot; &quot;$texte&quot;
	elif test &quot;$alignement&quot; = &quot;C&quot;
	then
		printf &quot;%`expr $nbcolonnes / 2 + ${#texte} / 2 `s\n&quot; &quot;$texte&quot;
	fi
}

affiche_texte &quot;HELLO WORLD !&quot; &quot;R&quot;
affiche_texte &quot;HELLO WORLD !&quot; &quot;C&quot;
affiche_texte &quot;HELLO WORLD !&quot; &quot;L&quot;

exit 0</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/printf">[printf]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Wed, 09 Jan 2008 08:56:10 +0000</pubDate>

            <category>bash</category>
            <category>printf</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Backup quotidien de repertoires</title>
        <link>http://www.posteet.com/view/575</link>
        <description>
        <![CDATA[<pre>#!/bin/sh

# Ce script est a appeler dans la crontab :
# ~$ crontab -e
# 0 6 * * * /home/benoit/make_backups.sh &gt;&gt;/home/benoit/backups_automatises.log
# Dans l'exemple, ce script sera execute tous les jours a 6h00 du matin

# sauvegarde d'un repertoire
make_backup ()
{
	rep=$1
	
	# Si un fichier porte deja ce nom, on le renomme (juste au cas ou)
	if test -f &quot;${rep}_${date_du_jour}.tar.gz&quot;
	then
		mv &quot;${rep}_${date_du_jour}.tar.gz&quot; &quot;${rep}_${date_du_jour}_old.tar.gz&quot; &gt;&gt; &quot;$log&quot; 2&gt;&gt; &quot;$log&quot;
		echo &quot;Le fichier ${rep}_${date_du_jour}.tar.gz a ete renomme en ${rep}_${date_du_jour}_old.tar.gz&quot; &gt;&gt; &quot;$log&quot;
	fi
	
	echo &quot;SAUVEGARDE DE `echo $rep | tr [a-z] [A-Z]`...&quot;  &gt;&gt; &quot;$log&quot;

	# Sauvegarde du repertoire a la date du jour
	tar -cf &quot;${rep}_${date_du_jour}.tar&quot; &quot;${rep}&quot; &gt;&gt; &quot;$log&quot; 2&gt;&gt; &quot;$log&quot;
	gzip &quot;${rep}_${date_du_jour}.tar&quot;
	
	echo &quot;EFFECTUEE&quot;  &gt;&gt; &quot;$log&quot;
	
	# Suppression du fichier backup datant d'il y a trois jours
	if test -f &quot;${rep}_${avant_avant_hier}.tar.gz&quot; &amp;&amp; test -f &quot;${rep}_${avant_hier}.tar.gz&quot; &amp;&amp; test -f &quot;${rep}_${hier}.tar.gz&quot;
	then
		\rm -f &quot;${rep}_${avant_avant_hier}.tar.gz&quot; &gt;&gt; &quot;$log&quot; 2&gt;&gt; &quot;$log&quot;
		echo &quot;Le fichier ${rep}_${avant_avant_hier}.tar.gz a ete supprime&quot; &gt;&gt; &quot;$log&quot;
	fi
	
	echo &quot;&quot;  &gt;&gt; &quot;$log&quot;
}

repertoire_racine=&quot;/home/benoit&quot;
log=&quot;backups_automatises.log&quot;
date_du_jour=`date +'%y%m%d'`
hier=`date +'%y%m%d' -d 'yesterday'`
avant_hier=`date +'%y%m%d' -d '2 days ago'`
avant_avant_hier=`date +'%y%m%d' -d '3 days ago'`

cd &quot;$repertoire_racine&quot;

echo &quot;********************************************************************************&quot; &gt;&gt; &quot;$log&quot;
echo &quot;&quot;  &gt;&gt; &quot;$log&quot;
echo &quot;SAUVEGARDE DU `date +'%Y-%m-%d'` A `date +'%H:%M:%S'`&quot;  &gt;&gt; &quot;$log&quot;
echo &quot;&quot;  &gt;&gt; &quot;$log&quot;
echo &quot;&quot;  &gt;&gt; &quot;$log&quot;

make_backup &quot;repertoire1&quot;
make_backup &quot;repertoire2&quot;

exit 0</pre> <a href="http://www.posteet.com/tags/backup">[backup]</a>  <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/crontab">[crontab]</a>  <a href="http://www.posteet.com/tags/date">[date]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Tue, 11 Dec 2007 09:01:08 +0000</pubDate>

            <category>backup</category>
            <category>bash</category>
            <category>crontab</category>
            <category>date</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Utilisation ultra basique de xmessage</title>
        <link>http://www.posteet.com/view/570</link>
        <description>
        <![CDATA[<pre># Si xmessage existe, il est execute et la valeur du bouton clique est affiche dans le terminal
# Le -print permet de retourner le nom du bouton (OK ou Annuler dans l'exemple) dans le terminal

xmess=`which xmessage 2&gt;&gt; /dev/null | wc -w | tr -d ' '`

if test &quot;$xmess&quot; = &quot;1&quot;
then
     xmessage -buttons 'OK':1,'Annuler':2 -print 'Hello world !'
     echo $?
fi</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/xmessage">[xmessage]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Mon, 10 Dec 2007 15:10:48 +0000</pubDate>

            <category>bash</category>
            <category>shell</category>
            <category>xmessage</category>
    
    </item>

  
    <item>
        <title>Chercher les fichiers de plus de 7 jours et les supprimer</title>
        <link>http://www.posteet.com/view/544</link>
        <description>
        <![CDATA[<pre>find repertoire -type f -mtime +7d -exec /bin/rm {} \;</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/find">[find]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Tue, 04 Dec 2007 15:31:34 +0000</pubDate>

            <category>bash</category>
            <category>find</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Lister les lignes triées d'un fichier en éliminant les doublons</title>
        <link>http://www.posteet.com/view/524</link>
        <description>
        <![CDATA[<pre># Permet de dresser la liste des lignes d'un fichier, triees, en supprimant toutes les lignes qui font doublon

ficorig=&quot;fichier_origine&quot;;ficdest=&quot;fichier_destination&quot;;sort -o ${ficorig}.sort ${ficorig};while read line;do if test &quot;$line&quot; != &quot;$sauve&quot;;then sauve=`echo $line`;echo $line &gt;&gt; $ficdest;fi;done &lt; ${ficorig}.sort;\rm ${ficorig}.sort</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/doublons">[doublons]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Mon, 26 Nov 2007 14:04:57 +0000</pubDate>

            <category>bash</category>
            <category>doublons</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Renommer des MP3 ou des photos</title>
        <link>http://www.posteet.com/view/523</link>
        <description>
        <![CDATA[<pre># Permet de renommer l'ensemble des fichiers d'un repertoire de photos ou de musiques, en prenant en compte les espaces dans les noms

rep=&quot;Radiohead - In Rainbows&quot;;fic=&quot;radiohead_in_rainbows_&quot;;ext=&quot;.mp3&quot;;j=1;ls &quot;$rep&quot; | while read i;do echo &quot;$i&quot;;if test $j -lt 10;then cp &quot;${rep}/${i}&quot; &quot;${rep}/${fic}0${j}${ext}&quot;;else cp &quot;${rep}/${i}&quot; &quot;${rep}/${fic}${j}${ext}&quot;;fi;j=`expr $j + 1`;done</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/renommer">[renommer]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Mon, 26 Nov 2007 10:16:35 +0000</pubDate>

            <category>bash</category>
            <category>renommer</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Lister toutes les occurrences d'une liste de chaines dans tous les fichiers</title>
        <link>http://www.posteet.com/view/400</link>
        <description>
        <![CDATA[<pre>for i in `find . -name &quot;*.jsp&quot; -print`; do echo &quot;&quot;;echo ${i};echo &quot;*******************************************************************************************&quot; ; while read ligne; do cat $i | grep &quot;$ligne&quot; | grep -v &quot;pas_cette_chaine&quot; ; done &lt; fichier_liste_des_occurrences ; done</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/recherche">[recherche]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/while">[while]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Mon, 12 Nov 2007 15:20:12 +0000</pubDate>

            <category>bash</category>
            <category>recherche</category>
            <category>shell</category>
            <category>while</category>
    
    </item>

  
    <item>
        <title>Rendre exécutable tous les scripts d'un coup</title>
        <link>http://www.posteet.com/view/243</link>
        <description>
        <![CDATA[<pre># Permet de rendre exécutable tous les scripts présents dans les répertoires et sous-répertoires à partir de la position où nous sommes

chmod 755 `find . -name '*.sh' -print`</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/chmod">[chmod]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Tue, 06 Nov 2007 08:54:43 +0000</pubDate>

            <category>bash</category>
            <category>chmod</category>
    
    </item>

  
    <item>
        <title>Remplacer les CRLF par des LF</title>
        <link>http://www.posteet.com/view/242</link>
        <description>
        <![CDATA[<pre># Permet de remplacer les CRLF de fin de lignes par des LF dans l'ensemble des fichiers listés par le find
# NB : on crée obligatoirement un nouveau fichier avant de remplacer l'original, sinon on risque de se retrouver avec un fichier vide

for i in `find . -name '*.sh' -print`;do echo &quot;Traitement de $i...&quot;;sed 's/\x0D$//' $i &gt; $i.CRLFtoLF;mv -f $i.CRLFtoLF $i;done

# Ne pas omettre de rendre a nouveau executable les scripts Shell
for i in `find . -name '*.sh' -print`;do echo &quot;Traitement de $i...&quot;; chmod +x $i;done</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/crlf">[crlf]</a>  <a href="http://www.posteet.com/tags/lf">[lf]</a>  <a href="http://www.posteet.com/tags/linux">[linux]</a>  <a href="http://www.posteet.com/tags/sed">[sed]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Tue, 06 Nov 2007 08:51:42 +0000</pubDate>

            <category>bash</category>
            <category>crlf</category>
            <category>lf</category>
            <category>linux</category>
            <category>sed</category>
    
    </item>


</channel>
</rss>
