#!/bin/bash source llibreria.sh existeix $1 if [ $# -ne "1" ] then echo "Ús: $0 fitxer" >&2 exit 3 fi echo "Sumare fitxer $1" suma=$(tr "\n" "+" < $1 | sed 's/+/ + /g') total=$(expr $suma 0) echo "La suma és $total" exit 0