ajout du tp9

master
antoine.perederii 2 years ago
parent a1b68aa5d6
commit 6dd90cc088

@ -1,9 +1,12 @@
#!/bin/bash #!/bin/bash
i=0 i=1
a=1
while read L; do while read L; do
if [ $ if [ $i -eq 0 ]; then
echo "$L" | egrep -q "[0-9]{2}"| tr a-z A-Z echo -n "$a "
shift echo "$L" | egrep [0-9]{2} | tr a-z A-Z
i=$(($i + 1)) fi
a=$(($a + 1))
i=$(($a%2))
done done

@ -0,0 +1,15 @@
#!/bin/bash
for f in $(ls $1); do
if [ $(echo "$?") -eq "127" ]; then
shift
elif [ $# -eq 0 ]; then
echo "Aucun arg ou aucun fichier dans ce repertoire" >&2
fi
if [ ls -l --time-style +%Y-%m-%d $1/$f | tr -s " " | cut -d " " -f 8 -e ]; then
cp $f $(ls -l --time-style +%Y-%m-%d $1/$f | tr -s " " | cut -d " " -f 8)
else
mkdir $(ls -l --time-style +%Y-%m-%d $1/$f | tr -s " " | cut -d " " -f 8)
cp $f $(ls -l --time-style +%Y-%m-%d $1/$f | tr -s " " | cut -d " " -f 8)
fi
done
Loading…
Cancel
Save