#!/bin/bash if [ $# -ne 2 ]; then echo "usage : ./ " exit 1 fi if [ $1 = "sel" ]; then cut -d' ' -f$2 ventes.dat echo "nb de lignes : " cut -d' ' -f$2 ventes.dat | wc -l elif [ $1 = "som" ]; then total=0 ligne=`grep $2 ventes.dat | cut -d' ' -f2:6` for i in $ligne do total=$(($total+i)) done echo $2 " -> total: " $total else echo "opération invalide" fi