[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script bash 2



Le Lundi 17 Avril 2006 17:57, ced a écrit :
> Bonjour, moi aussi j'ai un petit soucis avec un script :
>
>
> #! /bin/sh
>
> i=0
> cat "/etc/passwd" | while read ligne ; do
>       i=$((i + 1))
> done
> echo $i
>
> Voila, il est cencé compter les ligne du fichier /etc/passwd, mais quand
> je l'éxécute, il me retourne systématiquement 0.
> Si vous voyez pourquoi ca marche po ca serait le top.

i=`wc -l /etc/passwd | cut -f1 -d" "`
echo $i

-- 
Florent

Attachment: pgpeITLVDd9As.pgp
Description: PGP signature


Reply to: