tp2-adminsys/2_while.sh
2022-10-12 11:21:33 +02:00

23 lines
425 B
Bash
Executable file

#!/bin/bash
fichier="/etc/services"
while read ligne
do
if [ ! -z "$ligne" ] && [[ ! "$ligne" =~ ^#.* ]]
then
# Pour afficher la ligne seule
# echo $ligne
port=$(echo "$ligne" | cut -f3)
soft=$(echo "$ligne" | cut -f1)
if [ ! -z "$port" ]
then
#Pour afficher le port seul
#echo "Port $port"
#Affichage port + nom du logiciel
echo "Port / nom prog. : $port $soft"
fi
fi
done < $fichier