Existe-t-il un bon moyen d'expliquer comment fonctionne ce qui suit?
~$ echo $test
en.to.tre
~$ echo ${test}
en.to.tre
~$ echo ${test%.*}
en.to
~$ echo ${test%%.*}
en
~$ echo ${test#*.}
to.tre
~$ echo ${test##*.}
tre
En particulier, je ne comprends pas pourquoi .
et *
doivent être permutés lors du retrait/de maintien gauche/droite.
Vous pouvez vérifier ceci: [wooledge.org - Comment utiliser l'extension des paramètres? Comment puis-je obtenir des sous-chaînes? Comment puis-je obtenir un fichier sans son extension, ou obtenir juste l'extension d'un fichier?] (Http://mywiki.wooledge.org/BashFAQ/073) – fedorqui
Peut-être aussi vérifier ceci: http://tldp.org/LDP/abs /html/refcards.html#AEN22664 – devnull