I have to complete this script for a beginner BASH class but it seems like without the first line, my script fully execute its task but when I added the http / https verification (FIRST LINE) it don't go through the rest of it. Could you explain to me why? When I remove the quiet option of my grep I see that it work perfectly but it won't continue to read the script until the wget.
grep -Eiq "^https?://" <<<$1 || echo 'Ce script supporte seulement les URLs commencant par https:// ou http://' && exit 1
NOMBRE=`echo "$1" | grep -o '/' 2> /dev/null | wc -l`
NOMBRE=$((NOMBRE+1))
ITEM=`echo "$1" | cut -d '/' -f$NOMBRE 2> /dev/null`
wget -q $1 && echo "Votre fichier a ete telecharge ici: "$PWD/$ITEM