Solution exercice 9

Script 9.1

#!/bin/bash
if [ $# != 1 ]
then
echo "Erreur de syntaxe"
exit
fi

i=0

while [ $i -lt $1 ]; do
touch test$i.aaa
i=$[$i + 1 ]
done

Script 9.2

#!/bin/bash

if [ $# != 2 ]; then
echo "Erreur de syntaxe"
exit
fi
ls *.$1 | xargs -i@ basename @ .$1 | xargs -i -t mv \{\}.$1 \{\}.$2


Copyright Richard Buchmann & Emmanuel Viaud, université P.M. Curie 2005, MAJ 25 février, 2007