lynn #6 a écrit@pingouinux
Les deux premières commandes me renvoie tout ce qu'il y a après le premier signe égal... Je ne souhaiterais que le nom et la version.
La troisième commande ne me renvoie rien.
Dans ce cas, montre le contenu de ton
/etc/os-release. Chez moi ça fonctionne.
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
$ awk -F'"' '/PRETTY_NAME/{gsub(/\.[0-9]+ .*/,"",$2);print $2}' /etc/os-release
Ubuntu 16.04
$ sed -rn '/PRETTY_NAME/s/^[^"]+"|\.[0-9]+ .*//gp' /etc/os-release
Ubuntu 16.04
$ grep -Po '(?<=PRETTY_NAME=").*(?=\.\d+ .*)' /etc/os-release
Ubuntu 16.04