From 6dd90cc088f6ce2560f1368f46763a8c43858966 Mon Sep 17 00:00:00 2001 From: "antoine.perederii" Date: Wed, 4 Jan 2023 11:58:19 +0100 Subject: [PATCH] ajout du tp9 --- systeme/tp/tp9/alpha.sh | 13 ++++++++----- systeme/tp/tp9/img-0001.jpg | 0 systeme/tp/tp9/img-0011.jpg | 0 systeme/tp/tp9/photos.bash | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 systeme/tp/tp9/img-0001.jpg create mode 100644 systeme/tp/tp9/img-0011.jpg create mode 100755 systeme/tp/tp9/photos.bash diff --git a/systeme/tp/tp9/alpha.sh b/systeme/tp/tp9/alpha.sh index a6711c5..c9b081b 100755 --- a/systeme/tp/tp9/alpha.sh +++ b/systeme/tp/tp9/alpha.sh @@ -1,9 +1,12 @@ #!/bin/bash -i=0 +i=1 +a=1 while read L; do - if [ $ - echo "$L" | egrep -q "[0-9]{2}"| tr a-z A-Z - shift - i=$(($i + 1)) + if [ $i -eq 0 ]; then + echo -n "$a " + echo "$L" | egrep [0-9]{2} | tr a-z A-Z + fi + a=$(($a + 1)) + i=$(($a%2)) done diff --git a/systeme/tp/tp9/img-0001.jpg b/systeme/tp/tp9/img-0001.jpg new file mode 100644 index 0000000..e69de29 diff --git a/systeme/tp/tp9/img-0011.jpg b/systeme/tp/tp9/img-0011.jpg new file mode 100644 index 0000000..e69de29 diff --git a/systeme/tp/tp9/photos.bash b/systeme/tp/tp9/photos.bash new file mode 100755 index 0000000..358f2d8 --- /dev/null +++ b/systeme/tp/tp9/photos.bash @@ -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