Try:

VAR=`wc -l < /etc/passwd`

this way the $VAR gets the output of the command executed inside the ` `.

----- Original Message -----
From: "Spanke, Alexander" <[EMAIL PROTECTED]>
To: "'RedHat General - Mailinglist'" <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 11:38 AM
Subject: Counting lines of a textfile


> Hi again,
>
> How can i count the lines of a text file and store it in a variable. But i
> should use the bash, so no perl, python script should it be.
>
> Now i use
> wc -l < file.txt | read dummy
>
> But it doesn't work :(
>
> Any ideas ?
>
> Regards / thnx
> Alex
> ----------------------------------------------
> [EMAIL PROTECTED]
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
> https://listman.redhat.com/mailman/listinfo/redhat-list
>



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to