From 10bf6e47f773f7b3de513a382c4366e12cfe9348 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Wed, 18 May 2022 21:01:10 +0200 Subject: [PATCH] ajout fonction upper --- myfunctions.sh | 6 ++++++ test.sh | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/myfunctions.sh b/myfunctions.sh index 6a979b3..2f23bc1 100644 --- a/myfunctions.sh +++ b/myfunctions.sh @@ -1,3 +1,9 @@ +# ecrire une fonction upper qui passe la chaine de caract_re +# passée en param en majuscules +function upper { + echo "$@" | tr [a-z] [A-Z] +} + function myerror { code=$1 shift diff --git a/test.sh b/test.sh index 1c31b42..04ed818 100644 --- a/test.sh +++ b/test.sh @@ -5,4 +5,6 @@ set -u source myfunctions.sh -myerror 42 hello world \ No newline at end of file +chaineEnMaj=$(upper "Hello world") + +echo la chaine a été convertie en majuscules: $chaineEnMaj \ No newline at end of file